blob: f5fa5ce6b3fae91ac11e3b0282339a79c49e6fca [file] [log] [blame]
Jakub Latusek44f0fdd2020-10-21 13:36:29 +02001{{/*
rope252cd2142c2018-09-17 12:35:36 +01002# ============LICENSE_START=======================================================
3# Copyright (C) 2018 Ericsson. All rights reserved.
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +02004# Modifications Copyright © 2020 Nokia
rope252cd2142c2018-09-17 12:35:36 +01005# ================================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# SPDX-License-Identifier: Apache-2.0
19# ============LICENSE_END=========================================================
20# @author: gareth.roper@ericsson.com
Jakub Latusek44f0fdd2020-10-21 13:36:29 +020021*/}}
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020022apiVersion: apps/v1
rope252cd2142c2018-09-17 12:35:36 +010023kind: Deployment
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010024metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
rope252cd2142c2018-09-17 12:35:36 +010025spec:
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010026 selector: {{- include "common.selectors" . | nindent 4 }}
27 replicas: {{ .Values.replicaCount }}
rope252cd2142c2018-09-17 12:35:36 +010028 minReadySeconds: {{ index .Values.minReadySeconds }}
29 strategy:
30 type: {{ index .Values.updateStrategy.type }}
31 rollingUpdate:
32 maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
33 maxSurge: {{ index .Values.updateStrategy.maxSurge }}
34 template:
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010035 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
rope252cd2142c2018-09-17 12:35:36 +010036 spec:
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010037 initContainers:
rope252cd2142c2018-09-17 12:35:36 +010038 - name: so-chown
Sylvain Desbureaux747982c2020-11-19 17:40:05 +010039 image: {{ include "repositoryGenerator.image.busybox" . }}
rope252cd2142c2018-09-17 12:35:36 +010040 volumeMounts:
41 - name: logs
42 mountPath: /app/logs
jmacc4f04d32018-10-12 18:24:24 +000043 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
rope252cd2142c2018-09-17 12:35:36 +010044 command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
45 restartPolicy: Always
46 containers:
47 - name: {{ include "common.name" . }}
Sylvain Desbureaux747982c2020-11-19 17:40:05 +010048 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +010049 resources: {{ include "common.resources" . | nindent 10 }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020050 command:
51 - /bin/sh
52 args:
53 - -c
54 - |
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010055 export SO_COCKPIT_PASSWORD=`htpasswd -bnBC 10 "" $SO_COCKPIT_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'`
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020056 /app/start-app.sh
rope252cd2142c2018-09-17 12:35:36 +010057 env:
58 - name: DB_HOST
krishnaa9692b606b2020-10-30 11:29:21 +053059 value: {{ include "common.mariadbService" . }}
rope252cd2142c2018-09-17 12:35:36 +010060 - name: DB_PORT
krishnaa9692b606b2020-10-30 11:29:21 +053061 value: {{ include "common.mariadbPort" . | quote }}
rope252cd2142c2018-09-17 12:35:36 +010062 - name: DB_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010063 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010064 - name: DB_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010065 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010066 - name: DB_ADMIN_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010067 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010068 - name: DB_ADMIN_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010069 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010070 - name: SO_COCKPIT_USERNAME
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020071 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }}
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010072 - name: SO_COCKPIT_PASS
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020073 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }}
74
rope252cd2142c2018-09-17 12:35:36 +010075 envFrom:
76 - configMapRef:
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010077 name: {{ include "common.fullname" . }}
jmacc4f04d32018-10-12 18:24:24 +000078 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010079 volumeMounts:
rope252cd2142c2018-09-17 12:35:36 +010080 - name: logs
81 mountPath: /app/logs
rope252cd2142c2018-09-17 12:35:36 +010082 - name: config
83 mountPath: /app/config
84 readOnly: true
85 readinessProbe:
86 tcpSocket:
87 port: {{ index .Values.readinessProbe.port }}
88 initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}}
89 periodSeconds: {{ index .Values.readinessProbe.periodSeconds}}
90 livenessProbe:
91 tcpSocket:
92 port: {{ index .Values.livenessProbe.port }}
93 initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
94 periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
95 successThreshold: {{ index .Values.livenessProbe.successThreshold}}
96 failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
97
Andreas Geisslerad61ccf2023-02-23 09:17:36 +010098 ports: {{ include "common.containerPorts" . | nindent 10 }}
farida azmy87f46222021-04-06 15:25:15 +020099 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Andreas Geisslerad61ccf2023-02-23 09:17:36 +0100100 volumes:
rope252cd2142c2018-09-17 12:35:36 +0100101 - name: logs
102 emptyDir: {}
rope252cd2142c2018-09-17 12:35:36 +0100103 - name: config
104 configMap:
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +0100105 name: {{ include "common.fullname" . }}-app
rope252cd2142c2018-09-17 12:35:36 +0100106 imagePullSecrets:
107 - name: "{{ include "common.namespace" . }}-docker-registry-key"