[ONAP-wide] Replace .Release.Name with common.release
[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       - command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - oof-has-controller
40         - --container-name
41         - aaf-service
42         env:
43         - name: NAMESPACE
44           valueFrom:
45             fieldRef:
46               apiVersion: v1
47               fieldPath: metadata.namespace
48         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         name: {{ include "common.name" . }}-readiness
51       - command:
52         - /root/job_complete.py
53         args:
54         - -j
55         - "{{ include "common.release" . }}-oof-has-onboard"
56         env:
57         - name: NAMESPACE
58           valueFrom:
59             fieldRef:
60               apiVersion: v1
61               fieldPath: metadata.namespace
62         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         name: {{ include "common.name" . }}-onboard-readiness
65       - command:
66         - sh
67         - -c
68         - resp="FAILURE";
69           until [ $resp = "200" ]; do
70           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" . }}:10443/v1/sms/domain/has/secret);
71           echo $resp;
72           sleep 2;
73           done
74         env:
75         - name: NAMESPACE
76           valueFrom:
77             fieldRef:
78               apiVersion: v1
79               fieldPath: metadata.namespace
80         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
81         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
82         name: {{ include "common.name" . }}-has-sms-readiness
83       containers:
84         - name: {{ include "common.name" . }}
85           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
86           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
87           command: ["/bin/bash","-c"]
88           args: ["nginx && /usr/local/bin/uwsgi -s /run/conductor/uwsgi.sock --chmod-socket=777 --wsgi-file /etc/nginx/conductor.wsgi --callable application --set port=80 --die-on-term --exit-on-reload --logto /opt/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:80"]
89           ports:
90           - containerPort: {{ .Values.liveness.periodSeconds }}
91           # disable liveness probe when breakpoints set in debugger
92           # so K8s doesn't restart unresponsive container
93           {{- if .Values.liveness.enabled }}
94           livenessProbe:
95             tcpSocket:
96               port: {{ .Values.service.internalPort }}
97             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
98             periodSeconds: {{ .Values.liveness.periodSeconds }}
99           {{ end -}}
100           readinessProbe:
101             tcpSocket:
102               port: {{ .Values.service.internalPort }}
103             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
104             periodSeconds: {{ .Values.readiness.periodSeconds }}
105           env:
106           volumeMounts:
107           - mountPath: /etc/localtime
108             name: localtime
109             readOnly: true
110           - mountPath: /etc/nginx/nginx.conf
111             name: {{ .Values.global.commonConfigPrefix  }}-config
112             subPath: nginx.conf
113           - mountPath: /usr/local/etc/conductor/conductor.conf
114             name: {{ .Values.global.commonConfigPrefix  }}-config
115             subPath: conductor.conf
116           - mountPath: /usr/local/bin/log.conf
117             name: {{ .Values.global.commonConfigPrefix  }}-config
118             subPath: log.conf
119           - mountPath: /usr/local/bin/AAF_RootCA.cer
120             name: {{ .Values.global.commonConfigPrefix }}-config
121             subPath: AAF_RootCA.cer
122           - mountPath: /etc/nginx/ssl/org.onap.oof.crt
123             name: {{ .Values.global.commonConfigPrefix }}-config
124             subPath: org.onap.oof.crt
125           - mountPath: /etc/nginx/ssl/org.onap.oof.key
126             name: {{ .Values.global.commonConfigPrefix }}-config
127             subPath: org.onap.oof.key
128           resources:
129 {{ include "common.resources" . | indent 12 }}
130         {{- if .Values.nodeSelector }}
131         nodeSelector:
132 {{ toYaml .Values.nodeSelector | indent 10 }}
133         {{- end -}}
134         {{- if .Values.affinity }}
135         affinity:
136 {{ toYaml .Values.affinity | indent 10 }}
137         {{- end }}
138       volumes:
139         - name: localtime
140           hostPath:
141             path: /etc/localtime
142         - name: {{ .Values.global.commonConfigPrefix }}-config
143           configMap:
144             name: {{ .Values.global.commonConfigPrefix  }}-configmap
145             items:
146             - key: nginx.conf
147               path: nginx.conf
148             - key: conductor.conf
149               path: conductor.conf
150             - key: log.conf
151               path: log.conf
152             - key: AAF_RootCA.cer
153               path: AAF_RootCA.cer
154             - key: org.onap.oof.key
155               path: org.onap.oof.key
156             - key: org.onap.oof.crt
157               path: org.onap.oof.crt
158       imagePullSecrets:
159       - name: "{{ include "common.namespace" . }}-docker-registry-key"