blob: 9463b2827144643197e1e6ea72e4be0a02974b39 [file] [log] [blame]
rope252cd2142c2018-09-17 12:35:36 +01001# ============LICENSE_START=======================================================
2# Copyright (C) 2018 Ericsson. All rights reserved.
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +02003# Modifications Copyright © 2020 Nokia
rope252cd2142c2018-09-17 12:35:36 +01004# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
19# @author: gareth.roper@ericsson.com
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020020apiVersion: apps/v1
rope252cd2142c2018-09-17 12:35:36 +010021kind: Deployment
22metadata:
23 name: {{ include "common.fullname" . }}
24 namespace: {{ include "common.namespace" . }}
25 labels:
26 app: {{ include "common.fullname" . }}
27 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010028 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010029spec:
Grzegorz-Lisd1c1f6a2020-07-29 12:22:40 +020030 selector:
31 matchLabels:
32 app: {{ include "common.name" . }}
rope252cd2142c2018-09-17 12:35:36 +010033 replicas: {{ index .Values.replicaCount }}
34 minReadySeconds: {{ index .Values.minReadySeconds }}
35 strategy:
36 type: {{ index .Values.updateStrategy.type }}
37 rollingUpdate:
38 maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
39 maxSurge: {{ index .Values.updateStrategy.maxSurge }}
40 template:
41 metadata:
42 labels:
43 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010044 release: {{ include "common.release" . }}
rope252cd2142c2018-09-17 12:35:36 +010045 spec:
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020046 initContainers: {{ include "so.certificate.container_importer" . | nindent 6 }}
rope252cd2142c2018-09-17 12:35:36 +010047 - name: so-chown
48 image: alpine:3.6
49 volumeMounts:
50 - name: logs
51 mountPath: /app/logs
jmacc4f04d32018-10-12 18:24:24 +000052 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
rope252cd2142c2018-09-17 12:35:36 +010053 command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /app/logs"]
54 restartPolicy: Always
55 containers:
56 - name: {{ include "common.name" . }}
57 image: {{ include "common.repository" . }}/{{ .Values.image }}
seshukm0df1f8e2020-08-17 21:45:49 +053058 resources: {{ include "common.resources" . | nindent 12 }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020059 command:
60 - /bin/sh
61 args:
62 - -c
63 - |
64 export SO_MONITORING_PASSWORD=`htpasswd -bnBC 10 "" $SO_MON_PASS | tr -d ':\n' | sed 's/\$2y/\$2a/'`
65 {{- if .Values.global.aafEnabled }}
66 export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/org.onap.so.cred.props | xargs -0)
67 export $(grep '^c' {{ .Values.soHelpers.certInitializer.credsPath }}/mycreds.prop | xargs -0)
68 export KEYSTORE=file://$cadi_keystore
69 export KEYSTORE_PASSWORD=$cadi_keystore_password_p12
70 export TRUSTSTORE=file://$cadi_truststore
71 export TRUSTSTORE_PASSWORD=$cadi_truststore_password
72 {{- end }}
73 /app/start-app.sh
rope252cd2142c2018-09-17 12:35:36 +010074 env:
75 - name: DB_HOST
76 valueFrom:
77 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010078 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010079 key: mariadb.readwrite.host
80 - name: DB_PORT
81 valueFrom:
82 secretKeyRef:
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010083 name: {{ include "common.release" . }}-so-db-secrets
rope252cd2142c2018-09-17 12:35:36 +010084 key: mariadb.readwrite.port
85 - name: DB_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010086 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010087 - name: DB_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010088 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010089 - name: DB_ADMIN_USERNAME
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010090 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "login") | indent 10 }}
rope252cd2142c2018-09-17 12:35:36 +010091 - name: DB_ADMIN_PASSWORD
Krzysztof Opasiak0be83cb2020-03-24 21:44:00 +010092 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-admin-creds" "key" "password") | indent 10 }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +020093 - name: SO_MONITORING_USERNAME
94 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 10 }}
95 - name: SO_MON_PASS
96 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 10 }}
97
rope252cd2142c2018-09-17 12:35:36 +010098 envFrom:
99 - configMapRef:
100 name: {{ include "common.fullname" . }}-configmap
jmacc4f04d32018-10-12 18:24:24 +0000101 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +0200102 volumeMounts: {{ include "so.certificate.volumeMount" . | nindent 8 }}
rope252cd2142c2018-09-17 12:35:36 +0100103 - name: logs
104 mountPath: /app/logs
rope252cd2142c2018-09-17 12:35:36 +0100105 - name: config
106 mountPath: /app/config
107 readOnly: true
108 readinessProbe:
109 tcpSocket:
110 port: {{ index .Values.readinessProbe.port }}
111 initialDelaySeconds: {{ index .Values.readinessProbe.initialDelaySeconds}}
112 periodSeconds: {{ index .Values.readinessProbe.periodSeconds}}
113 livenessProbe:
114 tcpSocket:
115 port: {{ index .Values.livenessProbe.port }}
116 initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
117 periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
118 successThreshold: {{ index .Values.livenessProbe.successThreshold}}
119 failureThreshold: {{ index .Values.livenessProbe.failureThreshold}}
120
121 ports:
122 - containerPort: {{ index .Values.containerPort }}
123 name: {{ .Values.service.portName }}
124 protocol: TCP
Krzysztof Gajewskicd2e66f2020-10-15 20:33:34 +0200125 volumes: {{ include "so.certificate.volumes" . | nindent 6 }}
rope252cd2142c2018-09-17 12:35:36 +0100126 - name: logs
127 emptyDir: {}
rope252cd2142c2018-09-17 12:35:36 +0100128 - name: config
129 configMap:
130 name: {{ include "common.fullname" . }}-app-configmap
131 imagePullSecrets:
132 - name: "{{ include "common.namespace" . }}-docker-registry-key"