Merge "[UUI] Service Mesh Compliance for UUI"
[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         - --job-name
45         - {{ include "common.release" . }}-{{ .Values.config.etcd.configJobNameOverride }}-job
46         {{- if (include "common.needTLS" .) }}
47         - --container-name
48         - aaf-sms
49         {{- end }}
50         env:
51         - name: NAMESPACE
52           valueFrom:
53             fieldRef:
54               apiVersion: v1
55               fieldPath: metadata.namespace
56         image: {{ include "repositoryGenerator.image.readiness" . }}
57         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58
59       {{- if (include "common.needTLS" .) }}
60       - name: {{ include "common.name" . }}-cont-sms-readiness
61         command:
62         - sh
63         - -c
64         - resp="FAILURE";
65           until [ $resp = "200" ]; do
66           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
67           echo $resp;
68           sleep 2;
69           done
70         env:
71         - name: NAMESPACE
72           valueFrom:
73             fieldRef:
74               apiVersion: v1
75               fieldPath: metadata.namespace
76         image: {{ include "repositoryGenerator.image.curl" . }}
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78       {{- end }}
79       containers:
80         - name: {{ include "common.name" . }}
81           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
82           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
83           command:
84           - python
85           args:
86           - /usr/local/bin/conductor-controller
87           - --config-file=/usr/local/bin/conductor.conf
88           # disable liveness probe when breakpoints set in debugger
89           # so K8s doesn't restart unresponsive container
90           {{- if .Values.liveness.enabled }}
91           livenessProbe:
92             exec:
93               command:
94               - cat
95               - /usr/local/bin/healthy.sh
96             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
97             periodSeconds: {{ .Values.liveness.periodSeconds }}
98           {{ end -}}
99           readinessProbe:
100             exec:
101               command:
102               - cat
103               - /usr/local/bin/healthy.sh
104             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
105             periodSeconds: {{ .Values.readiness.periodSeconds }}
106           env: {{ include "oof.etcd.env" . | nindent 10 }}
107           volumeMounts:
108           - mountPath: /etc/localtime
109             name: localtime
110             readOnly: true
111           - mountPath: /usr/local/bin/conductor.conf
112             name: {{ .Values.global.commonConfigPrefix }}-config
113             subPath: conductor.conf
114           - mountPath: /usr/local/bin/log.conf
115             name: {{ .Values.global.commonConfigPrefix }}-config
116             subPath: log.conf
117           - mountPath: /usr/local/bin/healthy.sh
118             name: {{ .Values.global.commonConfigPrefix }}-config
119             subPath: healthy.sh
120           {{- if (include "common.needTLS" .) }}
121           - mountPath: /usr/local/bin/AAF_RootCA.cer
122             name: {{ include "common.fullname" . }}-onap-certs
123             subPath: aaf_root_ca.cer
124           {{- end }}
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       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
136       volumes:
137         - name: localtime
138           hostPath:
139             path: /etc/localtime
140         - name: {{ .Values.global.commonConfigPrefix }}-config
141           configMap:
142             name: {{ .Values.global.commonConfigPrefix }}-configmap
143             items:
144             - key: conductor.conf
145               path: conductor.conf
146             - key: log.conf
147               path: log.conf
148             - key: healthy.sh
149               path: healthy.sh
150 {{- if (include "common.needTLS" .) }}
151 {{ include "oof.certificate.volume" . | indent 8 }}
152 {{- end }}
153       imagePullSecrets:
154       - name: "{{ include "common.namespace" . }}-docker-registry-key"