Merge "updating portal db bootstrap job image"
[oom.git] / kubernetes / oof / charts / oof-has / charts / oof-has-api / 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         - oof-has-controller
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" . }}-has-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-api
89           - --port={{ .Values.service.internalPort }}
90           - --
91           - --config-file=/usr/local/bin/conductor.conf
92           ports:
93           - containerPort: {{ .Values.service.internalPort }}
94           # disable liveness probe when breakpoints set in debugger
95           # so K8s doesn't restart unresponsive container
96           {{- if .Values.liveness.enabled }}
97           livenessProbe:
98             tcpSocket:
99               port: {{ .Values.service.internalPort }}
100             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
101             periodSeconds: {{ .Values.liveness.periodSeconds }}
102           {{ end -}}
103           readinessProbe:
104             tcpSocket:
105               port: {{ .Values.service.internalPort }}
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/AAF_RootCA.cer
120             name: {{ .Values.global.commonConfigPrefix }}-config
121             subPath: AAF_RootCA.cer
122           resources:
123 {{ include "common.resources" . | indent 12 }}
124         {{- if .Values.nodeSelector }}
125         nodeSelector:
126 {{ toYaml .Values.nodeSelector | indent 10 }}
127         {{- end -}}
128         {{- if .Values.affinity }}
129         affinity:
130 {{ toYaml .Values.affinity | indent 10 }}
131         {{- end }}
132       volumes:
133         - name: localtime
134           hostPath:
135             path: /etc/localtime
136         - name: {{ .Values.global.commonConfigPrefix }}-config
137           configMap:
138             name: {{ .Values.global.commonConfigPrefix  }}-configmap
139             items:
140             - key: conductor.conf
141               path: conductor.conf
142             - key: log.conf
143               path: log.conf
144             - key: AAF_RootCA.cer
145               path: AAF_RootCA.cer
146       imagePullSecrets:
147       - name: "{{ include "common.namespace" . }}-docker-registry-key"