Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / oof / components / oof-has / components / oof-has-controller / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T,VMware
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   replicas: {{ .Values.replicaCount }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "common.name" . }}
37         release: {{ include "common.release" . }}
38     spec:
39       initContainers:
40       - name: {{ include "common.name" . }}-readiness
41         command:
42         - /app/ready.py
43         args:
44         - --container-name
45         - music-springboot
46         - --container-name
47         - aaf-sms
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         image: {{ include "repositoryGenerator.image.readiness" . }}
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56
57       - name: {{ include "common.name" . }}-onboard-readiness
58         command:
59         - /app/ready.py
60         args:
61         - -j
62         - "{{ include "common.release" . }}-oof-has-onboard"
63         env:
64         - name: NAMESPACE
65           valueFrom:
66             fieldRef:
67               apiVersion: v1
68               fieldPath: metadata.namespace
69         image: {{ include "repositoryGenerator.image.readiness" . }}
70         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71
72       - name: {{ include "common.name" . }}-cont-sms-readiness
73         command:
74         - sh
75         - -c
76         - resp="FAILURE";
77           until [ $resp = "200" ]; do
78           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
79           echo $resp;
80           sleep 2;
81           done
82         env:
83         - name: NAMESPACE
84           valueFrom:
85             fieldRef:
86               apiVersion: v1
87               fieldPath: metadata.namespace
88         image: {{ include "repositoryGenerator.image.curl" . }}
89         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90       containers:
91         - name: {{ include "common.name" . }}
92           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
93           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94           command:
95           - python
96           args:
97           - /usr/local/bin/conductor-controller
98           - --config-file=/usr/local/bin/conductor.conf
99           # disable liveness probe when breakpoints set in debugger
100           # so K8s doesn't restart unresponsive container
101           {{- if .Values.liveness.enabled }}
102           livenessProbe:
103             exec:
104               command:
105               - cat
106               - /usr/local/bin/healthy.sh
107             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
108             periodSeconds: {{ .Values.liveness.periodSeconds }}
109           {{ end -}}
110           readinessProbe:
111             exec:
112               command:
113               - cat
114               - /usr/local/bin/healthy.sh
115             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
116             periodSeconds: {{ .Values.readiness.periodSeconds }}
117           env:
118           volumeMounts:
119           - mountPath: /etc/localtime
120             name: localtime
121             readOnly: true
122           - mountPath: /usr/local/bin/conductor.conf
123             name: {{ .Values.global.commonConfigPrefix }}-config
124             subPath: conductor.conf
125           - mountPath: /usr/local/bin/log.conf
126             name: {{ .Values.global.commonConfigPrefix }}-config
127             subPath: log.conf
128           - mountPath: /usr/local/bin/healthy.sh
129             name: {{ .Values.global.commonConfigPrefix }}-config
130             subPath: healthy.sh
131           - mountPath: /usr/local/bin/AAF_RootCA.cer
132             name: {{ include "common.fullname" . }}-onap-certs
133             subPath: aaf_root_ca.cer
134           resources:
135 {{ include "common.resources" . | indent 12 }}
136         {{- if .Values.nodeSelector }}
137         nodeSelector:
138 {{ toYaml .Values.nodeSelector | indent 10 }}
139         {{- end -}}
140         {{- if .Values.affinity }}
141         affinity:
142 {{ toYaml .Values.affinity | indent 10 }}
143         {{- end }}
144       volumes:
145         - name: localtime
146           hostPath:
147             path: /etc/localtime
148         - name: {{ .Values.global.commonConfigPrefix }}-config
149           configMap:
150             name: {{ .Values.global.commonConfigPrefix }}-configmap
151             items:
152             - key: conductor.conf
153               path: conductor.conf
154             - key: log.conf
155               path: log.conf
156             - key: healthy.sh
157               path: healthy.sh
158 {{ include "oof.certificate.volume" . | indent 8 }}
159       imagePullSecrets:
160       - name: "{{ include "common.namespace" . }}-docker-registry-key"