Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 1 | {{/* |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 2 | # Copyright © 2018 Amdocs, AT&T |
| 3 | # Modifications Copyright © 2018 Bell Canada |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 4 | # Modifications Copyright © 2020-2021 Orange |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 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. |
Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 17 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 18 | |
| 19 | apiVersion: apps/v1 |
| 20 | kind: Deployment |
| 21 | metadata: |
| 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 }} |
| 29 | spec: |
| 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 Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 42 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 43 | {{- end -}} |
| 44 | {{- if .Values.affinity }} |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 45 | 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} |
Radoslaw Chmiel | 88534f1 | 2022-02-28 21:33:01 +0100 | [diff] [blame] | 59 | export JETTY_UTIL_JAR=$(find /usr/local/jetty/lib/ -regextype sed -regex ".*jetty-util-[0-9].*.jar") |
| 60 | export KEYSTORE_PASSWORD=`java -cp ${JETTY_UTIL_JAR} org.eclipse.jetty.util.security.Password ${KEYSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"` |
| 61 | export TRUSTSTORE_PASSWORD=`java -cp ${JETTY_UTIL_JAR} org.eclipse.jetty.util.security.Password ${TRUSTSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"` |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 62 | echo "KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop |
| 63 | echo "TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop |
| 64 | image: {{ include "repositoryGenerator.image.jetty" . }} |
| 65 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 66 | name: {{ include "common.name" . }}-obfuscate |
| 67 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
| 68 | securityContext: |
| 69 | runAsUser: {{ .Values.securityContext.user_id }} |
| 70 | - command: |
| 71 | - sh |
| 72 | args: |
| 73 | - -c |
| 74 | - | |
| 75 | echo "*** Set obfuscated Truststore and Keystore password into configuration file" |
| 76 | export $(cat {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop | xargs -0) |
| 77 | cd /config-input |
| 78 | for PFILE in `ls -1` |
| 79 | do |
| 80 | envsubst <${PFILE} >/config/${PFILE} |
| 81 | done |
| 82 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
| 83 | - mountPath: /config-input |
| 84 | name: prop-config-input |
| 85 | - mountPath: /config |
| 86 | name: prop-config |
| 87 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
| 88 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 89 | name: {{ include "common.name" . }}-update-config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 90 | {{- end }} |
| 91 | containers: |
| 92 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 93 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 94 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 95 | env: |
| 96 | - name: CONFIG_HOME |
| 97 | value: /opt/app/model-loader/config/ |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 98 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 99 | - mountPath: /etc/localtime |
| 100 | name: localtime |
| 101 | readOnly: true |
| 102 | - mountPath: /opt/app/model-loader/config/model-loader.properties |
| 103 | subPath: model-loader.properties |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 104 | name: prop-config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 105 | - mountPath: /opt/app/model-loader/config/auth/ |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 106 | name: auth-config |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 107 | - mountPath: {{ .Values.log.path }} |
| 108 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 109 | - mountPath: /opt/app/model-loader/logback.xml |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 110 | name: log-config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 111 | subPath: logback.xml |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 112 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 113 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 114 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 115 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 116 | volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 117 | - name: localtime |
| 118 | hostPath: |
| 119 | path: /etc/localtime |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 120 | - name: prop-config |
othman touijer | 5117667 | 2021-12-01 16:21:18 +0100 | [diff] [blame] | 121 | {{- if .Values.global.aafEnabled }} |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 122 | emptyDir: |
| 123 | medium: Memory |
othman touijer | 5117667 | 2021-12-01 16:21:18 +0100 | [diff] [blame] | 124 | - name: prop-config-input |
| 125 | {{- end }} |
| 126 | configMap: |
| 127 | name: {{ include "common.fullname" . }}-prop |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 128 | - name: auth-config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 129 | secret: |
| 130 | secretName: {{ include "common.fullname" . }} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 131 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 132 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 133 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | 1e99719 | 2021-02-28 14:59:22 +0100 | [diff] [blame] | 134 | - name: log-config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 135 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 136 | name: {{ include "common.fullname" . }}-log |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 137 | restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }} |
| 138 | imagePullSecrets: |
| 139 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |