[DCAEMOD] Uses new tpls for repos / images
[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 "common.repository" . }}/{{ .Values.global.readinessImage }}"
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57
58       - name: {{ include "common.name" . }}-onboard-readiness
59         command:
60         - /app/ready.py
61         args:
62         - -j
63         - "{{ include "common.release" . }}-oof-has-onboard"
64         env:
65         - name: NAMESPACE
66           valueFrom:
67             fieldRef:
68               apiVersion: v1
69               fieldPath: metadata.namespace
70         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
71         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72
73       - name: {{ include "common.name" . }}-has-sms-readiness
74         command:
75         - sh
76         - -c
77         - resp="FAILURE";
78           until [ $resp = "200" ]; do
79           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
80           echo $resp;
81           sleep 2;
82           done
83         env:
84         - name: NAMESPACE
85           valueFrom:
86             fieldRef:
87               apiVersion: v1
88               fieldPath: metadata.namespace
89         image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
90         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
91 {{ include "common.certInitializer.initContainer" . | indent 6 }}
92
93       containers:
94         - name: {{ include "common.name" . }}
95           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
96           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
97           command: ["/bin/bash","-c"]
98           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 }}"]
99           ports:
100           - containerPort: {{ .Values.uwsgi.internalPort }}
101           # disable liveness probe when breakpoints set in debugger
102           # so K8s doesn't restart unresponsive container
103           {{- if .Values.liveness.enabled }}
104           livenessProbe:
105             tcpSocket:
106               port: {{ .Values.uwsgi.internalPort }}
107             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
108             periodSeconds: {{ .Values.liveness.periodSeconds }}
109           {{ end -}}
110           readinessProbe:
111             tcpSocket:
112               port: {{ .Values.uwsgi.internalPort }}
113             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
114             periodSeconds: {{ .Values.readiness.periodSeconds }}
115           env:
116           volumeMounts:
117           - mountPath: /etc/localtime
118             name: localtime
119             readOnly: true
120           - mountPath: /usr/local/etc/conductor/conductor.conf
121             name: {{ .Values.global.commonConfigPrefix }}-config
122             subPath: conductor.conf
123           - mountPath: /usr/local/bin/log.conf
124             name: {{ .Values.global.commonConfigPrefix  }}-config
125             subPath: log.conf
126           - mountPath: /usr/local/bin/AAF_RootCA.cer
127             name: {{ include "common.fullname" . }}-onap-certs
128             subPath: aaf_root_ca.cer
129           resources:
130 {{ include "common.resources" . | indent 12 }}
131         - name: {{ include "common.name" . }}-nginx
132           image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.nginx.image }}"
133           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
134           command:
135           - /bin/sh
136           args:
137           - "-c"
138           - |
139             grep -v '^$'  /opt/bitnami/nginx/ssl/local/org.onap.oof.crt > /tmp/oof.crt
140             cat /tmp/oof.crt /tmp/intermediate_root_ca.pem /tmp/AAF_RootCA.cer >> /opt/bitnami/nginx/org.onap.oof.crt
141             /opt/bitnami/scripts/nginx/entrypoint.sh /opt/bitnami/scripts/nginx/run.sh
142           ports:
143           - containerPort: {{ .Values.service.internalPort }}
144           {{- if .Values.liveness.enabled }}
145           livenessProbe:
146             tcpSocket:
147               port: {{ .Values.service.internalPort }}
148             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
149             periodSeconds: {{ .Values.liveness.periodSeconds }}
150           {{ end -}}
151           readinessProbe:
152             tcpSocket:
153               port: {{ .Values.service.internalPort }}
154             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
155             periodSeconds: {{ .Values.readiness.periodSeconds }}
156           volumeMounts:
157 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
158           - mountPath: /etc/localtime
159             name: localtime
160             readOnly: true
161           - mountPath: /opt/bitnami/nginx/conf/nginx.conf
162             name: {{ .Values.global.commonConfigPrefix  }}-config
163             subPath: nginx.conf
164           - mountPath: /tmp/AAF_RootCA.cer
165             name: {{ include "common.fullname" . }}-onap-certs
166             subPath: aaf_root_ca.cer
167           - mountPath: /tmp/intermediate_root_ca.pem
168             name: {{ include "common.fullname" . }}-onap-certs
169             subPath: intermediate_root_ca.pem
170           resources:
171 {{ include "common.resources" . | indent 12 }}
172         {{- if .Values.nodeSelector }}
173         nodeSelector:
174 {{ toYaml .Values.nodeSelector | indent 10 }}
175         {{- end -}}
176         {{- if .Values.affinity }}
177         affinity:
178 {{ toYaml .Values.affinity | indent 10 }}
179         {{- end }}
180       volumes:
181         {{ include "common.certInitializer.volumes" . | nindent 8 }}
182         - name: localtime
183           hostPath:
184             path: /etc/localtime
185         - name: {{ .Values.global.commonConfigPrefix }}-config
186           configMap:
187             name: {{ .Values.global.commonConfigPrefix  }}-configmap
188             items:
189             - key: nginx.conf
190               path: nginx.conf
191             - key: conductor.conf
192               path: conductor.conf
193             - key: log.conf
194               path: log.conf
195 {{ include "oof.certificate.volume" . | indent 8 }}
196       imagePullSecrets:
197       - name: "{{ include "common.namespace" . }}-docker-registry-key"