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