blob: c4098b1a3b868d83a86bd22e0d6f38b8520c8e22 [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002# Copyright © 2018 Amdocs, AT&T
3# Modifications Copyright © 2018 Bell Canada
Sylvain Desbureaux1e997192021-02-28 14:59:22 +01004# Modifications Copyright © 2020-2021 Orange
Sylvain Desbureaux70070412020-11-09 21:58:48 +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.
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010017*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010018
19apiVersion: apps/v1
20kind: Deployment
21metadata:
22 name: {{ include "common.fullname" . }}
23 namespace: {{ include "common.namespace" . }}
24 labels:
25 app: {{ include "common.name" . }}
26 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27 release: {{ include "common.release" . }}
28 heritage: {{ .Release.Service }}
29spec:
30 replicas: {{ .Values.replicaCount }}
31 selector:
32 matchLabels:
33 app: {{ include "common.name" . }}
34 template:
35 metadata:
36 labels:
37 app: {{ include "common.name" . }}
38 release: {{ include "common.release" . }}
39 name: {{ include "common.name" . }}
40 spec:
41 {{- if .Values.nodeSelector }}
Sylvain Desbureaux1e997192021-02-28 14:59:22 +010042 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010043 {{- end -}}
44 {{- if .Values.affinity }}
Sylvain Desbureaux1e997192021-02-28 14:59:22 +010045 affinity: {{ toYaml .Values.affinity | nindent 8 }}
46 {{- end }}
47 {{- if .Values.global.aafEnabled }}
48 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
49 - command:
50 - sh
51 args:
52 - -c
53 - |
54 echo "*** retrieve Truststore and Keystore password"
55 export $(cat {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop | xargs -0)
56 echo "*** obfuscate them "
57 export KEYSTORE_PLAIN_PASSWORD=${KEYSTORE_PLAIN_PASSWORD}
58 export TRUSTSTORE_PLAIN_PASSWORD=${TRUSTSTORE_PLAIN_PASSWORD}
59 export KEYSTORE_PASSWORD=`java -cp /usr/local/jetty/lib/jetty-util-9.4.44.v20210927.jar org.eclipse.jetty.util.security.Password ${KEYSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"`
60 export TRUSTSTORE_PASSWORD=`java -cp /usr/local/jetty/lib/jetty-util-9.4.44.v20210927.jar org.eclipse.jetty.util.security.Password ${TRUSTSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"`
61 echo "KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop
62 echo "TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop
63 image: {{ include "repositoryGenerator.image.jetty" . }}
64 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65 name: {{ include "common.name" . }}-obfuscate
66 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
67 securityContext:
68 runAsUser: {{ .Values.securityContext.user_id }}
69 - command:
70 - sh
71 args:
72 - -c
73 - |
74 echo "*** Set obfuscated Truststore and Keystore password into configuration file"
75 export $(cat {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop | xargs -0)
76 cd /config-input
77 for PFILE in `ls -1`
78 do
79 envsubst <${PFILE} >/config/${PFILE}
80 done
81 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
82 - mountPath: /config-input
83 name: prop-config-input
84 - mountPath: /config
85 name: prop-config
86 image: {{ include "repositoryGenerator.image.envsubst" . }}
87 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88 name: {{ include "common.name" . }}-update-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +010089 {{- end }}
90 containers:
91 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010092 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010093 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94 env:
95 - name: CONFIG_HOME
96 value: /opt/app/model-loader/config/
Sylvain Desbureaux1e997192021-02-28 14:59:22 +010097 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010098 - mountPath: /etc/localtime
99 name: localtime
100 readOnly: true
101 - mountPath: /opt/app/model-loader/config/model-loader.properties
102 subPath: model-loader.properties
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100103 name: prop-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100104 - mountPath: /opt/app/model-loader/config/auth/
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100105 name: auth-config
Maciej Wereskid523d122021-09-21 11:22:13 +0200106 - mountPath: {{ .Values.log.path }}
107 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100108 - mountPath: /opt/app/model-loader/logback.xml
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100109 name: log-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100110 subPath: logback.xml
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100111 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200113 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200114 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100115 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100116 - name: localtime
117 hostPath:
118 path: /etc/localtime
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100119 - name: prop-config
othman touijer51176672021-12-01 16:21:18 +0100120 {{- if .Values.global.aafEnabled }}
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100121 emptyDir:
122 medium: Memory
othman touijer51176672021-12-01 16:21:18 +0100123 - name: prop-config-input
124 {{- end }}
125 configMap:
126 name: {{ include "common.fullname" . }}-prop
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100127 - name: auth-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100128 secret:
129 secretName: {{ include "common.fullname" . }}
Maciej Wereskid523d122021-09-21 11:22:13 +0200130 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100131 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200132 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux1e997192021-02-28 14:59:22 +0100133 - name: log-config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100134 configMap:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100135 name: {{ include "common.fullname" . }}-log
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100136 restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
137 imagePullSecrets:
138 - name: "{{ include "common.namespace" . }}-docker-registry-key"