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 © 2017 Amdocs, Bell Canada |
| 3 | # Modifications Copyright © 2018 AT&T |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 4 | # Modifications Copyright © 2020 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 }} |
Rommel Pawar | 63db716 | 2022-11-16 10:11:24 -0800 | [diff] [blame] | 31 | strategy: |
| 32 | type: {{ .Values.updateStrategy.type }} |
| 33 | {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }} |
| 34 | rollingUpdate: |
| 35 | maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }} |
| 36 | maxSurge: {{ .Values.updateStrategy.maxSurge }} |
| 37 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 38 | selector: |
| 39 | matchLabels: |
| 40 | app: {{ include "common.name" . }} |
| 41 | template: |
| 42 | metadata: |
| 43 | labels: |
| 44 | app: {{ include "common.name" . }} |
| 45 | release: {{ include "common.release" . }} |
| 46 | name: {{ include "common.name" . }} |
| 47 | annotations: |
| 48 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 49 | spec: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 50 | {{- if .Values.global.aafEnabled }} |
| 51 | initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }} |
| 52 | - command: |
| 53 | - sh |
| 54 | args: |
| 55 | - -c |
| 56 | - | |
| 57 | echo "*** retrieve Truststore and Keystore password" |
| 58 | export $(cat {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop | xargs -0) |
| 59 | echo "*** obfuscate them " |
| 60 | export KEYSTORE_PLAIN_PASSWORD=${KEYSTORE_PLAIN_PASSWORD} |
| 61 | export TRUSTSTORE_PLAIN_PASSWORD=${TRUSTSTORE_PLAIN_PASSWORD} |
Radoslaw Chmiel | 88534f1 | 2022-02-28 21:33:01 +0100 | [diff] [blame] | 62 | export JETTY_UTIL_JAR=$(find /usr/local/jetty/lib/ -regextype sed -regex ".*jetty-util-[0-9].*.jar") |
| 63 | export KEYSTORE_PASSWORD=`java -cp ${JETTY_UTIL_JAR} org.eclipse.jetty.util.security.Password ${KEYSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"` |
| 64 | export TRUSTSTORE_PASSWORD=`java -cp ${JETTY_UTIL_JAR} org.eclipse.jetty.util.security.Password ${TRUSTSTORE_PLAIN_PASSWORD} 2>&1 | grep "OBF:"` |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 65 | echo "KEYSTORE_PASSWORD=${KEYSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop |
| 66 | echo "TRUSTSTORE_PASSWORD=${TRUSTSTORE_PASSWORD}" >> {{ .Values.certInitializer.appMountPath }}/local/mycreds.prop |
| 67 | image: {{ include "repositoryGenerator.image.jetty" . }} |
| 68 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 69 | name: {{ include "common.name" . }}-obfuscate |
| 70 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
| 71 | securityContext: |
| 72 | runAsUser: {{ .Values.securityContext.user_id }} |
| 73 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 74 | containers: |
| 75 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 76 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 77 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 78 | {{- if .Values.global.aafEnabled }} |
| 79 | command: |
| 80 | - sh |
| 81 | args: |
| 82 | - -c |
| 83 | - | |
| 84 | echo "*** retrieve Truststore and Keystore password" |
| 85 | export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0) |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 86 | echo "*** actual launch of AAI Schema Service" |
| 87 | /bin/bash /opt/app/aai-schema-service/docker-entrypoint.sh |
| 88 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 89 | env: |
| 90 | - name: LOCAL_USER_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 91 | value: {{ .Values.securityContext.user_id | quote }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 92 | - name: LOCAL_GROUP_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 93 | value: {{ .Values.securityContext.group_id | quote }} |
| 94 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 95 | - mountPath: /etc/localtime |
| 96 | name: localtime |
| 97 | readOnly: true |
| 98 | - mountPath: /opt/app/aai-schema-service/resources/etc/appprops/aaiconfig.properties |
| 99 | name: aaiconfig-conf |
| 100 | subPath: aaiconfig.properties |
| 101 | - mountPath: /opt/aai/logroot/AAI-SS |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 102 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 103 | - mountPath: /opt/app/aai-schema-service/resources/logback.xml |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 104 | name: log-conf |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 105 | subPath: logback.xml |
| 106 | - mountPath: /opt/app/aai-schema-service/resources/localhost-access-logback.xml |
| 107 | name: localhost-access-log-conf |
| 108 | subPath: localhost-access-logback.xml |
| 109 | - mountPath: /opt/app/aai-schema-service/resources/etc/auth/realm.properties |
| 110 | name: realm-conf |
| 111 | subPath: realm.properties |
| 112 | - mountPath: /opt/app/aai-schema-service/resources/application.properties |
| 113 | name: springapp-conf |
| 114 | subPath: application.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 115 | ports: |
| 116 | - containerPort: {{ .Values.service.internalPort }} |
| 117 | - containerPort: {{ .Values.service.internalPort2 }} |
| 118 | # disable liveness probe when breakpoints set in debugger |
| 119 | # so K8s doesn't restart unresponsive container |
| 120 | {{ if .Values.liveness.enabled }} |
| 121 | livenessProbe: |
| 122 | tcpSocket: |
| 123 | port: {{ .Values.service.internalPort }} |
| 124 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 125 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 126 | {{ end }} |
| 127 | readinessProbe: |
| 128 | tcpSocket: |
| 129 | port: {{ .Values.service.internalPort }} |
| 130 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 131 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 132 | resources: |
| 133 | {{ include "common.resources" . | indent 12 }} |
| 134 | {{- if .Values.nodeSelector }} |
| 135 | nodeSelector: |
| 136 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 137 | {{- end -}} |
| 138 | {{- if .Values.affinity }} |
| 139 | affinity: |
| 140 | {{ toYaml .Values.affinity | indent 8 }} |
| 141 | {{- end }} |
| 142 | |
| 143 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 144 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 145 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 146 | volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 147 | - name: aai-common-aai-auth-mount |
| 148 | secret: |
| 149 | secretName: aai-common-aai-auth |
| 150 | - name: localtime |
| 151 | hostPath: |
| 152 | path: /etc/localtime |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 153 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 154 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 155 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 156 | - name: log-conf |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 157 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 158 | name: {{ include "common.fullname" . }}-log |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 159 | - name: localhost-access-log-conf |
| 160 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 161 | name: {{ include "common.fullname" . }}-localhost-access-log |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 162 | - name: springapp-conf |
| 163 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 164 | name: {{ include "common.fullname" . }}-springapp |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 165 | - name: aaiconfig-conf |
| 166 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 167 | name: {{ include "common.fullname" . }}-aaiconfig |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 168 | - name: realm-conf |
| 169 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 170 | name: {{ include "common.fullname" . }}-realm |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 171 | restartPolicy: {{ .Values.restartPolicy }} |
| 172 | imagePullSecrets: |
| 173 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |