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