Merge "Bump version of readiness image"
[oom.git] / kubernetes / oof / charts / oof-has / charts / oof-has-reservation / 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" . }}-resrv-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-reservation
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           readinessProbe:
119             exec:
120               command:
121               - cat
122               - /usr/local/bin/healthy.sh
123             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
124             periodSeconds: {{ .Values.readiness.periodSeconds }}
125           {{ end -}}
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/AAF_RootCA.cer
141             name: {{ .Values.global.commonConfigPrefix }}-config
142             subPath: AAF_RootCA.cer
143           resources:
144 {{ include "common.resources" . | indent 12 }}
145         {{- if .Values.nodeSelector }}
146         nodeSelector:
147 {{ toYaml .Values.nodeSelector | indent 10 }}
148         {{- end -}}
149         {{- if .Values.affinity }}
150         affinity:
151 {{ toYaml .Values.affinity | indent 10 }}
152         {{- end }}
153       volumes:
154         - name: localtime
155           hostPath:
156             path: /etc/localtime
157         - name: {{ .Values.global.commonConfigPrefix }}-config
158           configMap:
159             name: {{ .Values.global.commonConfigPrefix }}-configmap
160             items:
161             - key: conductor.conf
162               path: conductor.conf
163             - key: log.conf
164               path: log.conf
165             - key: healthy.sh
166               path: healthy.sh
167             - key: AAF_RootCA.cer
168               path: AAF_RootCA.cer
169
170       imagePullSecrets:
171       - name: "{{ include "common.namespace" . }}-docker-registry-key"