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