Merge "[DCAEGEN2] Ves-open-api Add mech to load config at deploy time"
[oom.git] / kubernetes / cds / components / cds-sdc-listener / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2019 Bell Canada
3 # Modification Copyright © 2022 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
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   replicas: {{ .Values.replicaCount }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40         - command:
41           - /app/ready.py
42           args:
43             - --container-name
44             - sdc-be
45             - --container-name
46             - cds-blueprints-processor
47           env:
48           - name: NAMESPACE
49             valueFrom:
50               fieldRef:
51                 apiVersion: v1
52                 fieldPath: metadata.namespace
53           image: {{ include "repositoryGenerator.image.readiness" . }}
54           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55           name: {{ include "common.name" . }}-readiness
56       containers:
57         - name: {{ include "common.name" . }}
58           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
59           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60           env:
61           - name: APP_CONFIG_HOME
62             value: {{ .Values.config.appConfigDir }}
63           - name: SECURITY_PROTOCOL
64             value: {{ .Values.config.kafka.securityProtocol }}
65           - name: SASL_MECHANISM
66             value: {{ .Values.config.kafka.saslMechanism }}
67           - name: SASL_JAAS_CONFIG
68             value: {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cds-sdc-kafka-secret" "key" "sasl.jaas.config") | indent 12 }}
69           ports:
70           - containerPort: {{ .Values.service.http.internalPort }}
71             name: {{ .Values.service.http.portName }}
72           {{ if .Values.liveness.enabled }}
73           livenessProbe:
74             httpGet:
75               path: /api/v1/sdclistener/healthcheck
76               port: {{ .Values.service.http.portName }}
77             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.liveness.periodSeconds }}
79           {{end}}
80           readinessProbe:
81             httpGet:
82               path: /api/v1/sdclistener/healthcheck
83               port: {{ .Values.service.http.portName }}
84             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
85             periodSeconds: {{ .Values.readiness.periodSeconds }}
86           volumeMounts:
87           - mountPath: {{ .Values.config.appConfigDir }}/application.yaml
88             name: {{ include "common.fullname" . }}-config
89             subPath: application.yaml
90           - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
91             name: {{ include "common.fullname" . }}-config
92             subPath: logback.xml
93           resources:
94 {{ include "common.resources" . | indent 12 }}
95         {{- if .Values.nodeSelector }}
96         nodeSelector:
97 {{ toYaml .Values.nodeSelector | indent 10 }}
98         {{- end -}}
99         {{- if .Values.affinity }}
100         affinity:
101 {{ toYaml .Values.affinity | indent 10 }}
102         {{- end }}
103       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
104       volumes:
105         - name: {{ include "common.fullname" . }}-config
106           configMap:
107             name: {{ include "common.fullname" . }}-configmap
108             items:
109             - key: application.yaml
110               path: application.yaml
111             - key: logback.xml
112               path: logback.xml
113       imagePullSecrets:
114       - name: {{ include "common.namespace" . }}-docker-registry-key