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