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