e52ac7a6d1cc5f85b541952159bb56b3e815ae76
[oom.git] / kubernetes / aai / components / aai-babel / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 Amdocs, AT&T
3 # Modifications Copyright © 2018 Bell Canada
4 # Modifications Copyright © 2020,2021 Orange
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.
17 */}}
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   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   strategy:
35     type: {{ .Values.updateStrategy.type }}
36     {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }}
37     rollingUpdate:
38       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
39       maxSurge: {{ .Values.updateStrategy.maxSurge }}
40     {{- end }}
41   template:
42     metadata:
43       labels:
44         app: {{ include "common.name" . }}
45         release: {{ include "common.release" . }}
46     spec:
47       initContainers:  {{ include "common.certInitializer.initContainer" . | nindent 6 }}
48       containers:
49         - name: {{ include "common.name" . }}
50           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           {{- if .Values.global.aafEnabled }}
53           command:
54           - sh
55           args:
56           - -c
57           - |
58             echo "*** retrieve Truststore and Keystore password"
59             export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
60             echo "*** actual launch of AAI Babel"
61             /bin/bash /opt/app/babel/bin/start.sh
62           {{- end }}
63           ports:
64           - containerPort: {{ .Values.service.internalPort }}
65           # disable liveness probe when breakpoints set in debugger
66           # so K8s doesn't restart unresponsive container
67           {{ if .Values.liveness.enabled }}
68           livenessProbe:
69             tcpSocket:
70               port: {{ .Values.service.internalPort }}
71             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.liveness.periodSeconds }}
73           {{ end }}
74           readinessProbe:
75             tcpSocket:
76               port: {{ .Values.service.internalPort }}
77             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.readiness.periodSeconds }}
79           env:
80             {{- if not (include "common.needTLS" .) }}
81             - name: KEY_STORE_PASSWORD
82               value: NotUsed
83             {{- end }}
84             - name: CONFIG_HOME
85               value: /opt/app/babel/config
86           volumeMounts:  {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
87           - mountPath: /etc/localtime
88             name: localtime
89             readOnly: true
90           - mountPath: /opt/app/babel/config/application.properties
91             name: config
92             subPath: application.properties
93           - mountPath: /opt/app/babel/config/artifact-generator.properties
94             name: config
95             subPath: artifact-generator.properties
96           - mountPath: /opt/app/babel/config/tosca-mappings.json
97             name: config
98             subPath: tosca-mappings.json
99           - mountPath: /opt/app/babel/config/babel-auth.properties
100             name: config
101             subPath: babel-auth.properties
102           - mountPath: /opt/app/babel/config/auth
103             name: secrets
104           - mountPath: {{ .Values.log.path }}
105             name: logs
106           - mountPath: /opt/app/babel/config/logback.xml
107             name: config
108             subPath: logback.xml
109           resources:
110 {{ include "common.resources" . }}
111       {{- if .Values.nodeSelector }}
112       nodeSelector:
113 {{ toYaml .Values.nodeSelector | indent 8 }}
114       {{- end -}}
115       {{- if .Values.affinity }}
116       affinity:
117 {{ toYaml .Values.affinity | indent 8 }}
118       {{- end }}
119
120         # side car containers
121       {{ include "common.log.sidecar" . | nindent 8 }}
122       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
123       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
124         - name: localtime
125           hostPath:
126             path: /etc/localtime
127         - name: config
128           configMap:
129             name: {{ include "common.fullname" . }}-configmap
130         - name: secrets
131           secret:
132             secretName: {{ include "common.fullname" . }}-babel-secrets
133         - name: logs
134           emptyDir: {}
135         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
136
137       imagePullSecrets:
138       - name: "{{ include "common.namespace" . }}-docker-registry-key"