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