397e8fd5565f104e9c66e0c34acc95f9e476d4ee
[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 # Modifications Copyright © 2023 Nordix Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 */}}
19
20 apiVersion: apps/v1
21 kind: Deployment
22 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
23 spec:
24   selector: {{- include "common.selectors" . | nindent 4 }}
25   replicas: {{ .Values.replicaCount }}
26   strategy:
27     type: {{ .Values.updateStrategy.type }}
28     {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }}
29     rollingUpdate:
30       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
31       maxSurge: {{ .Values.updateStrategy.maxSurge }}
32     {{- end }}
33   template:
34     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
35     spec:
36       containers:
37         - name: {{ include "common.name" . }}
38           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
39           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40           ports: {{ include "common.containerPorts" . | nindent 12  }}
41           # disable liveness probe when breakpoints set in debugger
42           # so K8s doesn't restart unresponsive container
43           {{ if .Values.liveness.enabled }}
44           livenessProbe:
45             tcpSocket:
46               port: {{ .Values.service.internalPort }}
47             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
48             periodSeconds: {{ .Values.liveness.periodSeconds }}
49           {{ end }}
50           readinessProbe:
51             tcpSocket:
52               port: {{ .Values.service.internalPort }}
53             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
54             periodSeconds: {{ .Values.readiness.periodSeconds }}
55           env:
56             - name: KEY_STORE_PASSWORD
57               value: NotUsed
58             - name: CONFIG_HOME
59               value: /opt/app/babel/config
60           volumeMounts:
61           - mountPath: /etc/localtime
62             name: localtime
63             readOnly: true
64           - mountPath: /opt/app/babel/config/application.properties
65             name: config
66             subPath: application.properties
67           - mountPath: /opt/app/babel/config/artifact-generator.properties
68             name: config
69             subPath: artifact-generator.properties
70           - mountPath: /opt/app/babel/config/tosca-mappings.json
71             name: config
72             subPath: tosca-mappings.json
73           - mountPath: /opt/app/babel/config/babel-auth.properties
74             name: config
75             subPath: babel-auth.properties
76           - mountPath: /opt/app/babel/config/auth
77             name: secrets
78           - mountPath: {{ .Values.log.path }}
79             name: logs
80           - mountPath: /opt/app/babel/config/logback.xml
81             name: config
82             subPath: logback.xml
83           resources: {{ include "common.resources" . | nindent 12 }}
84       {{- if .Values.nodeSelector }}
85       nodeSelector:
86 {{ toYaml .Values.nodeSelector | indent 8 }}
87       {{- end -}}
88       {{- if .Values.affinity }}
89       affinity:
90 {{ toYaml .Values.affinity | indent 8 }}
91       {{- end }}
92
93         # side car containers
94       {{ include "common.log.sidecar" . | nindent 8 }}
95       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
96       volumes:
97         - name: localtime
98           hostPath:
99             path: /etc/localtime
100         - name: config
101           configMap:
102             name: {{ include "common.fullname" . }}-configmap
103         - name: secrets
104           secret:
105             secretName: {{ include "common.fullname" . }}-babel-secrets
106         - name: logs
107           emptyDir: {}
108         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 8 }}
109
110       imagePullSecrets:
111       - name: "{{ include "common.namespace" . }}-docker-registry-key"