[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / cds / charts / cds-sdc-listener / templates / deployment.yaml
1 # Copyright (c) 2019 Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   selector:
27     matchLabels:
28       app: {{ include "common.name" . }}
29   replicas: {{ .Values.replicaCount }}
30   template:
31     metadata:
32       labels:
33         app: {{ include "common.name" . }}
34         release: {{ include "common.release" . }}
35     spec:
36       initContainers:
37         - command:
38           - /app/ready.py
39           args:
40             - --container-name
41             - sdc-be
42             - --container-name
43             - message-router
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 "common.repository" . }}/{{ .Values.global.readinessImage }}"
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           name: {{ include "common.name" . }}-readiness
55       containers:
56         - name: {{ include "common.name" . }}
57           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
58           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59           env:
60           - name: APP_CONFIG_HOME
61             value: {{ .Values.config.appConfigDir }}
62           ports:
63           - containerPort: {{ .Values.service.http.internalPort }}
64           {{ if .Values.liveness.enabled }}
65           livenessProbe:
66             httpGet:
67               path: /api/v1/sdclistener/healthcheck
68               port: {{ .Values.service.http.internalPort }}
69             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
70             periodSeconds: {{ .Values.liveness.periodSeconds }}
71           {{end}}
72           readinessProbe:
73             httpGet:
74               path: /api/v1/sdclistener/healthcheck
75               port: {{ .Values.service.http.internalPort }}
76             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
77             periodSeconds: {{ .Values.readiness.periodSeconds }}
78           volumeMounts:
79           - mountPath: {{ .Values.config.appConfigDir }}/application.yaml
80             name: {{ include "common.fullname" . }}-config
81             subPath: application.yaml
82           - mountPath: {{ .Values.config.appConfigDir }}/logback.xml
83             name: {{ include "common.fullname" . }}-config
84             subPath: logback.xml
85           resources:
86 {{ include "common.resources" . | indent 12 }}
87         {{- if .Values.nodeSelector }}
88         nodeSelector:
89 {{ toYaml .Values.nodeSelector | indent 10 }}
90         {{- end -}}
91         {{- if .Values.affinity }}
92         affinity:
93 {{ toYaml .Values.affinity | indent 10 }}
94         {{- end }}
95       volumes:
96         - name: {{ include "common.fullname" . }}-config
97           configMap:
98             name: {{ include "common.fullname" . }}-configmap
99             items:
100             - key: application.yaml
101               path: application.yaml
102             - key: logback.xml
103               path: logback.xml
104       imagePullSecrets:
105       - name: {{ include "common.namespace" . }}-docker-registry-key