Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / oof / components / oof-has / components / oof-has-api / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Copyright (C) 2020 Wipro Limited.
4 # Modifications Copyright © 2018 AT&T,VMware
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       initContainers:
41       - name: {{ include "common.name" . }}-readiness
42         command:
43         - /app/ready.py
44         args:
45         - --container-name
46         - oof-has-controller
47         - --container-name
48         - aaf-service
49         env:
50         - name: NAMESPACE
51           valueFrom:
52             fieldRef:
53               apiVersion: v1
54               fieldPath: metadata.namespace
55         image: {{ include "repositoryGenerator.image.readiness" . }}
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57
58       - name: {{ include "common.name" . }}-has-sms-readiness
59         command:
60         - sh
61         - -c
62         - resp="FAILURE";
63           until [ $resp = "200" ]; do
64           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
65           echo $resp;
66           sleep 2;
67           done
68         env:
69         - name: NAMESPACE
70           valueFrom:
71             fieldRef:
72               apiVersion: v1
73               fieldPath: metadata.namespace
74         image: {{ include "repositoryGenerator.image.curl" . }}
75         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76 {{ include "common.certInitializer.initContainer" . | indent 6 }}
77
78       containers:
79         - name: {{ include "common.name" . }}
80           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.image.optf_has }}
81           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82           command: ["/bin/sh","-c"]
83           args: ["/usr/local/bin/uwsgi -s /run/conductor/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port={{ .Values.uwsgi.internalPort }} --die-on-term --exit-on-reload --pidfile /run/conductor/conductor-uwsgi.pid --enable-threads --workers 6 --master --vacuum --single-interpreter --socket-timeout 10 --max-worker-lifetime 300 --max-requests 100 --no-defer-accept --protocol=uwsgi --socket 0.0.0.0:{{ .Values.uwsgi.internalPort }}"]
84           ports:
85           - containerPort: {{ .Values.uwsgi.internalPort }}
86           # disable liveness probe when breakpoints set in debugger
87           # so K8s doesn't restart unresponsive container
88           {{- if .Values.liveness.enabled }}
89           livenessProbe:
90             tcpSocket:
91               port: {{ .Values.uwsgi.internalPort }}
92             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
93             periodSeconds: {{ .Values.liveness.periodSeconds }}
94           {{ end -}}
95           readinessProbe:
96             tcpSocket:
97               port: {{ .Values.uwsgi.internalPort }}
98             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
99             periodSeconds: {{ .Values.readiness.periodSeconds }}
100           env: {{ include "oof.etcd.env" . | nindent 10 }}
101           volumeMounts:
102           - mountPath: /etc/localtime
103             name: localtime
104             readOnly: true
105           - mountPath: /usr/local/etc/conductor/conductor.conf
106             name: {{ .Values.global.commonConfigPrefix }}-config
107             subPath: conductor.conf
108           - mountPath: /usr/local/bin/log.conf
109             name: {{ .Values.global.commonConfigPrefix  }}-config
110             subPath: log.conf
111           - mountPath: /usr/local/bin/AAF_RootCA.cer
112             name: {{ include "common.fullname" . }}-onap-certs
113             subPath: aaf_root_ca.cer
114           resources:
115 {{ include "common.resources" . | indent 12 }}
116         - name: {{ include "common.name" . }}-nginx
117           image: {{ include "repositoryGenerator.image.nginx" . }}
118           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
119           command:
120           - /bin/sh
121           args:
122           - "-c"
123           - |
124             grep -v '^$'  /opt/bitnami/nginx/ssl/local/org.onap.oof.crt > /tmp/oof.crt
125             cat /tmp/oof.crt /tmp/intermediate_root_ca.pem /tmp/AAF_RootCA.cer >> /opt/bitnami/nginx/org.onap.oof.crt
126             /opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
127           ports:
128           - containerPort: {{ .Values.service.internalPort }}
129           {{- if .Values.liveness.enabled }}
130           livenessProbe:
131             tcpSocket:
132               port: {{ .Values.service.internalPort }}
133             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
134             periodSeconds: {{ .Values.liveness.periodSeconds }}
135           {{ end -}}
136           readinessProbe:
137             tcpSocket:
138               port: {{ .Values.service.internalPort }}
139             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
140             periodSeconds: {{ .Values.readiness.periodSeconds }}
141           volumeMounts:
142 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
143           - mountPath: /etc/localtime
144             name: localtime
145             readOnly: true
146           - mountPath: /opt/bitnami/nginx/conf/nginx.conf
147             name: {{ .Values.global.commonConfigPrefix  }}-config
148             subPath: nginx.conf
149           - mountPath: /tmp/AAF_RootCA.cer
150             name: {{ include "common.fullname" . }}-onap-certs
151             subPath: aaf_root_ca.cer
152           - mountPath: /tmp/intermediate_root_ca.pem
153             name: {{ include "common.fullname" . }}-onap-certs
154             subPath: intermediate_root_ca.pem
155           resources:
156 {{ include "common.resources" . | indent 12 }}
157         {{- if .Values.nodeSelector }}
158         nodeSelector:
159 {{ toYaml .Values.nodeSelector | indent 10 }}
160         {{- end -}}
161         {{- if .Values.affinity }}
162         affinity:
163 {{ toYaml .Values.affinity | indent 10 }}
164         {{- end }}
165       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
166       volumes:
167         {{ include "common.certInitializer.volumes" . | nindent 8 }}
168         - name: localtime
169           hostPath:
170             path: /etc/localtime
171         - name: {{ .Values.global.commonConfigPrefix }}-config
172           configMap:
173             name: {{ .Values.global.commonConfigPrefix  }}-configmap
174             items:
175             - key: nginx.conf
176               path: nginx.conf
177             - key: conductor.conf
178               path: conductor.conf
179             - key: log.conf
180               path: log.conf
181 {{ include "oof.certificate.volume" . | indent 8 }}
182       imagePullSecrets:
183       - name: "{{ include "common.namespace" . }}-docker-registry-key"