4ff2851b0cb81a011a584cb45a0d00bd420f8f17
[oom.git] / kubernetes / cps / components / ncmp-dmi-plugin / templates / deployment.yaml
1 {{/*
2 # ============LICENSE_START=======================================================
3 # Copyright (C) 2021 Nordix Foundation
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19 */}}
20
21 apiVersion: apps/v1
22 kind: Deployment
23 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
24 spec:
25   replicas: {{ .Values.replicaCount }}
26   minReadySeconds: {{ index .Values.minReadySeconds }}
27   strategy:
28     type: {{ index .Values.updateStrategy.type }}
29     rollingUpdate:
30       maxUnavailable: {{ index .Values.updateStrategy.maxUnavailable }}
31       maxSurge: {{ index .Values.updateStrategy.maxSurge }}
32   selector: {{- include "common.selectors" . | nindent 4 }}
33   template:
34     metadata:
35       labels:
36         app.kubernetes.io/name: {{ include "common.name" . }}
37         app.kubernetes.io/instance: {{ include "common.release" . }}
38     spec:
39       {{ include "common.podSecurityContext" . | indent 6 | trim}}
40       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . ) }}
41       initContainers: {{ include "common.readinessCheck.waitFor" . | nindent 6 }}
42       - name: {{ include "common.name" . }}-update-config
43         image: {{ include "repositoryGenerator.image.envsubst" . }}
44         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45         command:
46           - sh
47         args:
48           - -c
49           - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; done"
50         env:
51           - name: DMI_PLUGIN_USERNAME
52             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "login") | indent 12 }}
53           - name: DMI_PLUGIN_PASSWORD
54             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "app-user-creds" "key" "password") | indent 12 }}
55           - name: SDNC_USERNAME
56             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "login") | indent 12 }}
57           - name: SDNC_PASSWORD
58             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnc-creds" "key" "password") | indent 12 }}
59           - name: CPS_CORE_USERNAME
60             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "login") | indent 12 }}
61           - name: CPS_CORE_PASSWORD
62             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cps-core-creds" "key" "password") | indent 12 }}
63           - name: SASL_JAAS_CONFIG
64             valueFrom:
65               secretKeyRef:
66                 name: {{ include "common.name" . }}-ku
67                 key: sasl.jaas.config
68         volumeMounts:
69           - mountPath: /config-input
70             name: init-data-input
71           - mountPath: /config
72             name: init-data
73       containers:
74       - name: {{ include "common.name" . }}
75         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
76         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
77         ports: {{ include "common.containerPorts" . | nindent 10  }}
78         {{ include "common.containerSecurityContext" . | indent 8 | trim }}
79         # disable liveness probe when breakpoints set in debugger
80         # so K8s doesn't restart unresponsive container
81         {{- if eq .Values.liveness.enabled true }}
82         livenessProbe:
83           httpGet:
84             port: {{ .Values.liveness.port }}
85             path: {{ .Values.liveness.path }}
86           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
87           periodSeconds: {{ .Values.liveness.periodSeconds }}
88         {{ end -}}
89         readinessProbe:
90           httpGet:
91             port: {{ .Values.readiness.port }}
92             path: {{ .Values.readiness.path }}
93           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
94           periodSeconds: {{ .Values.readiness.periodSeconds }}
95         env:
96           - name: SPRING_PROFILES_ACTIVE
97             value: {{ .Values.config.spring.profile }}
98           - name: SASL_JAAS_CONFIG
99             valueFrom:
100               secretKeyRef:
101                 name: {{ include "common.name" . }}-ku
102                 key: sasl.jaas.config
103         resources: {{ include "common.resources" . | nindent 10 }}
104         {{- if .Values.nodeSelector }}
105         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 12 }}
106         {{- end }}
107         {{- if .Values.affinity }}
108         affinity: {{ toYaml .Values.affinity | nindent 12 }}
109         {{- end }}
110         volumeMounts:
111           - mountPath: /app/resources/application-helm.yml
112             subPath: application-helm.yml
113             name: init-data
114           - mountPath: /tmp
115             name: init-temp
116       volumes:
117         - name: init-data-input
118           configMap:
119             name: {{ include "common.fullname" . }}
120         - name: init-data
121           emptyDir:
122             medium: Memory
123         - name: init-temp
124           emptyDir: {}
125       imagePullSecrets:
126         - name: "{{ include "common.namespace" . }}-docker-registry-key"