Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / so / components / so-admin-cockpit / templates / deployment.yaml
1 {{/*
2 #  ============LICENSE_START=======================================================
3 #   Copyright (C) 2018 Ericsson. All rights reserved.
4 #   Modifications Copyright © 2020 Nokia
5 #  ================================================================================
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
21 */}}
22 apiVersion: apps/v1
23 kind: Deployment
24 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
25 spec:
26   selector: {{- include "common.selectors" . | nindent 4 }}
27   replicas: {{ .Values.replicaCount }}
28   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:
35     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
36     spec:
37       initContainers:
38       - name: so-chown
39         image: {{ include "repositoryGenerator.image.busybox" . }}
40         volumeMounts:
41         - name: logs
42           mountPath: /app/logs
43         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44         command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
45       restartPolicy: Always
46       containers:
47       - name: {{ include "common.name" . }}
48         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
49         resources: {{ include "common.resources" . | nindent 10 }}
50         command:
51         - /bin/sh
52         args:
53         - -c
54         - |
55           export SO_COCKPIT_PASSWORD=`htpasswd -bnBC 10 "" $SO_COCKPIT_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'`
56           /app/start-app.sh
57         env:
58         - name: DB_HOST
59           value: {{ include "common.mariadbService" . }}
60         - name: DB_PORT
61           value: {{ include "common.mariadbPort" . | quote }}
62         - name: DB_USERNAME
63           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
64         - name: DB_PASSWORD
65           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
66         - name: DB_ADMIN_USERNAME
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
68         - name: DB_ADMIN_PASSWORD
69           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
70         - name: SO_COCKPIT_USERNAME
71           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }}
72         - name: SO_COCKPIT_PASS
73           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }}
74
75         envFrom:
76         - configMapRef:
77             name: {{ include "common.fullname" . }}
78         imagePullPolicy:  {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
79         volumeMounts:
80         - name: logs
81           mountPath: /app/logs
82         - 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
98         ports: {{ include "common.containerPorts" . | nindent 10  }}
99       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
100       volumes:
101       - name: logs
102         emptyDir: {}
103       - name: config
104         configMap:
105             name: {{ include "common.fullname" . }}-app
106       {{- include "common.imagePullSecrets" . | nindent 6 }}