[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / oof / charts / oof-has / charts / oof-has-data / 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         env:
45         - name: NAMESPACE
46           valueFrom:
47             fieldRef:
48               apiVersion: v1
49               fieldPath: metadata.namespace
50         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52
53       - name: {{ include "common.name" . }}-onboard-readiness
54         command:
55         - /app/ready.py
56         args:
57         - -j
58         - "{{ include "common.release" . }}-oof-has-onboard"
59         env:
60         - name: NAMESPACE
61           valueFrom:
62             fieldRef:
63               apiVersion: v1
64               fieldPath: metadata.namespace
65         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67
68       - name: {{ include "common.name" . }}-health-readiness
69         command:
70         - /app/ready.py
71         args:
72         - -j
73         - "{{ include "common.release" . }}-oof-has-healthcheck"
74         env:
75         - name: NAMESPACE
76           valueFrom:
77             fieldRef:
78               apiVersion: v1
79               fieldPath: metadata.namespace
80         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
81         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82
83       - name: {{ include "common.name" . }}-data-sms-readiness
84         command:
85         - sh
86         - -c
87         - resp="FAILURE";
88           until [ $resp = "200" ]; do
89           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
90           echo $resp;
91           sleep 2;
92           done
93         env:
94         - name: NAMESPACE
95           valueFrom:
96             fieldRef:
97               apiVersion: v1
98               fieldPath: metadata.namespace
99         image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
100         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
101
102       containers:
103         - name: {{ include "common.name" . }}
104           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
105           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
106           command:
107           - python
108           args:
109           - /usr/local/bin/conductor-data
110           - --config-file=/usr/local/bin/conductor.conf
111           # disable liveness probe when breakpoints set in debugger
112           # so K8s doesn't restart unresponsive container
113           {{- if .Values.liveness.enabled }}
114           livenessProbe:
115             exec:
116               command:
117               - cat
118               - /usr/local/bin/healthy.sh
119             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
120             periodSeconds: {{ .Values.liveness.periodSeconds }}
121           {{ end -}}
122           readinessProbe:
123             exec:
124               command:
125               - cat
126               - /usr/local/bin/healthy.sh
127             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
128             periodSeconds: {{ .Values.readiness.periodSeconds }}
129           env:
130           volumeMounts:
131           - mountPath: /etc/localtime
132             name: localtime
133             readOnly: true
134           - mountPath: /usr/local/bin/conductor.conf
135             name: {{ .Values.global.commonConfigPrefix }}-config
136             subPath: conductor.conf
137           - mountPath: /usr/local/bin/log.conf
138             name: {{ .Values.global.commonConfigPrefix }}-config
139             subPath: log.conf
140           - mountPath: /usr/local/bin/healthy.sh
141             name: {{ .Values.global.commonConfigPrefix }}-config
142             subPath: healthy.sh
143           - mountPath: /usr/local/bin/aai_cert.cer
144             name: {{ .Values.global.commonConfigPrefix }}-config
145             subPath: aai_cert.cer
146           - mountPath: /usr/local/bin/aai_key.key
147             name: {{ .Values.global.commonConfigPrefix }}-config
148             subPath: aai_key.key
149           - mountPath: /usr/local/bin/AAF_RootCA.cer
150             name: {{ .Values.global.commonConfigPrefix }}-config
151             subPath: AAF_RootCA.cer
152           resources:
153 {{ include "common.resources" . | indent 12 }}
154         {{- if .Values.nodeSelector }}
155         nodeSelector:
156 {{ toYaml .Values.nodeSelector | indent 10 }}
157         {{- end -}}
158         {{- if .Values.affinity }}
159         affinity:
160 {{ toYaml .Values.affinity | indent 10 }}
161         {{- end }}
162       volumes:
163         - name: localtime
164           hostPath:
165             path: /etc/localtime
166         - name: {{ .Values.global.commonConfigPrefix }}-config
167           configMap:
168             name: {{ .Values.global.commonConfigPrefix }}-configmap
169             items:
170             - key: conductor.conf
171               path: conductor.conf
172             - key: log.conf
173               path: log.conf
174             - key: healthy.sh
175               path: healthy.sh
176             - key: aai_cert.cer
177               path: aai_cert.cer
178             - key: aai_key.key
179               path: aai_key.key
180             - key: AAF_RootCA.cer
181               path: AAF_RootCA.cer
182       imagePullSecrets:
183       - name: "{{ include "common.namespace" . }}-docker-registry-key"