[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / oof / charts / oof-has / charts / oof-has-controller / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T,VMware
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: apps/v1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       - name: {{ include "common.name" . }}-readiness
39         command:
40         - /app/ready.py
41         args:
42         - --container-name
43         - music-springboot
44         - --container-name
45         - aaf-sms
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
55       - name: {{ include "common.name" . }}-onboard-readiness
56         command:
57         - /app/ready.py
58         args:
59         - -j
60         - "{{ include "common.release" . }}-oof-has-onboard"
61         env:
62         - name: NAMESPACE
63           valueFrom:
64             fieldRef:
65               apiVersion: v1
66               fieldPath: metadata.namespace
67         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69
70       - name: {{ include "common.name" . }}-cont-sms-readiness
71         command:
72         - sh
73         - -c
74         - resp="FAILURE";
75           until [ $resp = "200" ]; do
76           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
77           echo $resp;
78           sleep 2;
79           done
80         env:
81         - name: NAMESPACE
82           valueFrom:
83             fieldRef:
84               apiVersion: v1
85               fieldPath: metadata.namespace
86         image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
87         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88       containers:
89         - name: {{ include "common.name" . }}
90           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
91           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
92           command:
93           - python
94           args:
95           - /usr/local/bin/conductor-controller
96           - --config-file=/usr/local/bin/conductor.conf
97           # disable liveness probe when breakpoints set in debugger
98           # so K8s doesn't restart unresponsive container
99           {{- if .Values.liveness.enabled }}
100           livenessProbe:
101             exec:
102               command:
103               - cat
104               - /usr/local/bin/healthy.sh
105             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
106             periodSeconds: {{ .Values.liveness.periodSeconds }}
107           {{ end -}}
108           readinessProbe:
109             exec:
110               command:
111               - cat
112               - /usr/local/bin/healthy.sh
113             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
114             periodSeconds: {{ .Values.readiness.periodSeconds }}
115           env:
116           volumeMounts:
117           - mountPath: /etc/localtime
118             name: localtime
119             readOnly: true
120           - mountPath: /usr/local/bin/conductor.conf
121             name: {{ .Values.global.commonConfigPrefix }}-config
122             subPath: conductor.conf
123           - mountPath: /usr/local/bin/log.conf
124             name: {{ .Values.global.commonConfigPrefix }}-config
125             subPath: log.conf
126           - mountPath: /usr/local/bin/healthy.sh
127             name: {{ .Values.global.commonConfigPrefix }}-config
128             subPath: healthy.sh
129           - mountPath: /usr/local/bin/AAF_RootCA.cer
130             name: {{ .Values.global.commonConfigPrefix }}-config
131             subPath: AAF_RootCA.cer
132           resources:
133 {{ include "common.resources" . | indent 12 }}
134         {{- if .Values.nodeSelector }}
135         nodeSelector:
136 {{ toYaml .Values.nodeSelector | indent 10 }}
137         {{- end -}}
138         {{- if .Values.affinity }}
139         affinity:
140 {{ toYaml .Values.affinity | indent 10 }}
141         {{- end }}
142       volumes:
143         - name: localtime
144           hostPath:
145             path: /etc/localtime
146         - name: {{ .Values.global.commonConfigPrefix }}-config
147           configMap:
148             name: {{ .Values.global.commonConfigPrefix }}-configmap
149             items:
150             - key: conductor.conf
151               path: conductor.conf
152             - key: log.conf
153               path: log.conf
154             - key: healthy.sh
155               path: healthy.sh
156             - key: AAF_RootCA.cer
157               path: AAF_RootCA.cer
158       imagePullSecrets:
159       - name: "{{ include "common.namespace" . }}-docker-registry-key"