blob: 8a7c43f0b95096b58290428c782aa9ded2b6f7be [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002# Copyright © 2017 Amdocs, Bell Canada
3# Modifications Copyright © 2018 AT&T
Sylvain Desbureaux5b651322020-12-07 15:34:15 +01004# Modifications Copyright © 2020 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 }}
Rommel Pawar63db7162022-11-16 10:11:24 -080031 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 Desbureaux70070412020-11-09 21:58:48 +010038 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 Desbureauxc57b58d2021-02-23 18:07:34 +010050 {{- 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 Chmiel88534f12022-02-28 21:33:01 +010062 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 Desbureauxc57b58d2021-02-23 18:07:34 +010065 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 Desbureaux70070412020-11-09 21:58:48 +010074 containers:
75 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010076 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010077 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010078 {{- 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 Desbureauxc57b58d2021-02-23 18:07:34 +010086 echo "*** actual launch of AAI Schema Service"
87 /bin/bash /opt/app/aai-schema-service/docker-entrypoint.sh
88 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010089 env:
90 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010091 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010092 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010093 value: {{ .Values.securityContext.group_id | quote }}
94 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010095 - 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 Wereskid523d122021-09-21 11:22:13 +0200102 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100103 - mountPath: /opt/app/aai-schema-service/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100104 name: log-conf
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100105 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 Desbureaux70070412020-11-09 21:58:48 +0100115 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 Wereskid523d122021-09-21 11:22:13 +0200144 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200145 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100146 volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100147 - name: aai-common-aai-auth-mount
148 secret:
149 secretName: aai-common-aai-auth
150 - name: localtime
151 hostPath:
152 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200153 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100154 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200155 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100156 - name: log-conf
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100157 configMap:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100158 name: {{ include "common.fullname" . }}-log
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100159 - name: localhost-access-log-conf
160 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100161 name: {{ include "common.fullname" . }}-localhost-access-log
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100162 - name: springapp-conf
163 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100164 name: {{ include "common.fullname" . }}-springapp
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100165 - name: aaiconfig-conf
166 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100167 name: {{ include "common.fullname" . }}-aaiconfig
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100168 - name: realm-conf
169 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100170 name: {{ include "common.fullname" . }}-realm
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100171 restartPolicy: {{ .Values.restartPolicy }}
172 imagePullSecrets:
173 - name: "{{ include "common.namespace" . }}-docker-registry-key"