blob: 9de1b50c8cf067f77ef94c6188402548625cf230 [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
24metadata:
25 name: {{ include "common.fullname" . }}
26 namespace: {{ include "common.namespace" . }}
27 labels:
28 app: {{ include "common.fullname" . }}
29 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010030 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010031spec:
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020032 selector:
33 matchLabels:
34 app: {{ include "common.name" . }}
rope252cd2142c2018-09-17 12:35:36 +010035 replicas: {{ index .Values.replicaCount }}
36 minReadySeconds: {{ index .Values.minReadySeconds }}
37 strategy:
38 type: {{ index .Values.updateStrategy.type }}
39 rollingUpdate:
40 maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
41 maxSurge: {{ index .Values.updateStrategy.maxSurge }}
42 template:
43 metadata:
44 labels:
45 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010046 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010047 spec:
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020048 initContainers: {{ include "so.certificate.container_importer" . | nindent 6 }}
rope252cd2142c2018-09-17 12:35:36 +010049 - name: so-chown
Sylvain Desbureaux747982c2020-11-19 17:40:05 +010050 image: {{ include "repositoryGenerator.image.busybox" . }}
rope252cd2142c2018-09-17 12:35:36 +010051 volumeMounts:
52 - name: logs
53 mountPath: /app/logs
jmacc4f04d32018-10-12 18:24:24 +000054 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
rope252cd2142c2018-09-17 12:35:36 +010055 command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
56 restartPolicy: Always
57 containers:
58 - name: {{ include "common.name" . }}
Sylvain Desbureaux747982c2020-11-19 17:40:05 +010059 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
seshukm0df1f8e2020-08-17 21:45:49 +053060 resources: {{ include "common.resources" . | nindent 12 }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020061 command:
62 - /bin/sh
63 args:
64 - -c
65 - |
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010066 export SO_COCKPIT_PASSWORD=`htpasswd -bnBC 10 "" $SO_COCKPIT_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'`
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020067 {{- if .Values.global.aafEnabled }}
68 export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/org.onap.so.cred.props | xargs -0)
Sylvain Desbureauxfde94072021-03-19 15:06:41 +010069 export $(cat {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020070 export KEYSTORE=file://$cadi_keystore
71 export KEYSTORE_PASSWORD=$cadi_keystore_password_p12
72 export TRUSTSTORE=file://$cadi_truststore
73 export TRUSTSTORE_PASSWORD=$cadi_truststore_password
74 {{- end }}
75 /app/start-app.sh
rope252cd2142c2018-09-17 12:35:36 +010076 env:
77 - name: DB_HOST
krishnaa9692b606b2020-10-30 11:29:21 +053078 value: {{ include "common.mariadbService" . }}
rope252cd2142c2018-09-17 12:35:36 +010079 - name: DB_PORT
krishnaa9692b606b2020-10-30 11:29:21 +053080 value: {{ include "common.mariadbPort" . | quote }}
rope252cd2142c2018-09-17 12:35:36 +010081 - name: DB_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010082 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010083 - name: DB_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010084 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010085 - name: DB_ADMIN_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010086 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010087 - name: DB_ADMIN_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010088 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010089 - name: SO_COCKPIT_USERNAME
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020090 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }}
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010091 - name: SO_COCKPIT_PASS
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020092 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }}
93
rope252cd2142c2018-09-17 12:35:36 +010094 envFrom:
95 - configMapRef:
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +010096 name: {{ include "common.fullname" . }}
jmacc4f04d32018-10-12 18:24:24 +000097 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020098 volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }}
rope252cd2142c2018-09-17 12:35:36 +010099 - name: logs
100 mountPath: /app/logs
rope252cd2142c2018-09-17 12:35:36 +0100101 - name: config
102 mountPath: /app/config
103 readOnly: true
104 readinessProbe:
105 tcpSocket:
106 port: {{ index .Values.readinessProbe.port }}
107 initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}}
108 periodSeconds: {{ index .Values.readinessProbe.periodSeconds}}
109 livenessProbe:
110 tcpSocket:
111 port: {{ index .Values.livenessProbe.port }}
112 initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
113 periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
114 successThreshold: {{ index .Values.livenessProbe.successThreshold}}
115 failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
116
117 ports:
118 - containerPort: {{ index .Values.containerPort }}
119 name: {{ .Values.service.portName }}
120 protocol: TCP
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +0200121 volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
rope252cd2142c2018-09-17 12:35:36 +0100122 - name: logs
123 emptyDir: {}
rope252cd2142c2018-09-17 12:35:36 +0100124 - name: config
125 configMap:
Sylvain Desbureaux1eff56b2021-02-25 14:13:01 +0100126 name: {{ include "common.fullname" . }}-app
rope252cd2142c2018-09-17 12:35:36 +0100127 imagePullSecrets:
128 - name: "{{ include "common.namespace" . }}-docker-registry-key"