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