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