Merge "vvp -- VNF Validation Platform"
[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: 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: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
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         - "{{ .Release.Name }}-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         - sh
65         - -c
66         - resp="FAILURE";
67           until [ $resp = "200" ]; do
68           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
69           echo $resp;
70           sleep 2;
71           done
72         env:
73         - name: NAMESPACE
74           valueFrom:
75             fieldRef:
76               apiVersion: v1
77               fieldPath: metadata.namespace
78         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
79         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
80         name: {{ include "common.name" . }}-cont-sms-readiness
81       containers:
82         - name: {{ include "common.name" . }}
83           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
84           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
85           command:
86           - python
87           args:
88           - /usr/local/bin/conductor-controller
89           - --config-file=/usr/local/bin/conductor.conf
90           # disable liveness probe when breakpoints set in debugger
91           # so K8s doesn't restart unresponsive container
92           {{- if .Values.liveness.enabled }}
93           livenessProbe:
94             exec:
95               command:
96               - cat
97               - /usr/local/bin/healthy.sh
98             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.liveness.periodSeconds }}
100           {{ end -}}
101           readinessProbe:
102             exec:
103               command:
104               - cat
105               - /usr/local/bin/healthy.sh
106             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
107             periodSeconds: {{ .Values.readiness.periodSeconds }}
108           env:
109           volumeMounts:
110           - mountPath: /etc/localtime
111             name: localtime
112             readOnly: true
113           - mountPath: /usr/local/bin/conductor.conf
114             name: {{ .Values.global.commonConfigPrefix }}-config
115             subPath: conductor.conf
116           - mountPath: /usr/local/bin/log.conf
117             name: {{ .Values.global.commonConfigPrefix }}-config
118             subPath: log.conf
119           - mountPath: /usr/local/bin/healthy.sh
120             name: {{ .Values.global.commonConfigPrefix }}-config
121             subPath: healthy.sh
122           - mountPath: /usr/local/bin/AAF_RootCA.cer
123             name: {{ .Values.global.commonConfigPrefix }}-config
124             subPath: AAF_RootCA.cer
125           resources:
126 {{ include "common.resources" . | indent 12 }}
127         {{- if .Values.nodeSelector }}
128         nodeSelector:
129 {{ toYaml .Values.nodeSelector | indent 10 }}
130         {{- end -}}
131         {{- if .Values.affinity }}
132         affinity:
133 {{ toYaml .Values.affinity | indent 10 }}
134         {{- end }}
135       volumes:
136         - name: localtime
137           hostPath:
138             path: /etc/localtime
139         - name: {{ .Values.global.commonConfigPrefix }}-config
140           configMap:
141             name: {{ .Values.global.commonConfigPrefix }}-configmap
142             items:
143             - key: conductor.conf
144               path: conductor.conf
145             - key: log.conf
146               path: log.conf
147             - key: healthy.sh
148               path: healthy.sh
149             - key: AAF_RootCA.cer
150               path: AAF_RootCA.cer
151       imagePullSecrets:
152       - name: "{{ include "common.namespace" . }}-docker-registry-key"