[DCAEMOD] Uses new tpls for repos / images
[oom.git] / kubernetes / oof / components / oof-has / components / oof-has-reservation / 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         - --container-name
45         - music-springboot
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54
55       - name: {{ include "common.name" . }}-onboard-readiness
56         command:
57         - /app/ready.py
58         args:
59         - -j
60         - "{{ include "common.release" . }}-oof-has-onboard"
61         env:
62         - name: NAMESPACE
63           valueFrom:
64             fieldRef:
65               apiVersion: v1
66               fieldPath: metadata.namespace
67         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69
70       - name: {{ include "common.name" . }}-health-readiness
71         command:
72         - /app/ready.py
73         args:
74         - -j
75         - "{{ include "common.release" . }}-oof-has-healthcheck"
76         env:
77         - name: NAMESPACE
78           valueFrom:
79             fieldRef:
80               apiVersion: v1
81               fieldPath: metadata.namespace
82         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
83         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
84
85       - name: {{ include "common.name" . }}-resrv-sms-readiness
86         command:
87         - sh
88         - -c
89         - resp="FAILURE";
90           until [ $resp = "200" ]; do
91           resp=$(curl -s -o /dev/null -k --write-out %{http_code} https://aaf-sms.{{ include "common.namespace" .}}:10443/v1/sms/domain/has/secret);
92           echo $resp;
93           sleep 2;
94           done
95         env:
96         - name: NAMESPACE
97           valueFrom:
98             fieldRef:
99               apiVersion: v1
100               fieldPath: metadata.namespace
101         image: "{{ .Values.global.dockerHubRepository }}/{{ .Values.global.curlImage }}"
102         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
103
104       containers:
105         - name: {{ include "common.name" . }}
106           image: "{{ include "common.repository" . }}/{{ .Values.global.image.optf_has }}"
107           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
108           command:
109           - python
110           args:
111           - /usr/local/bin/conductor-reservation
112           - --config-file=/usr/local/bin/conductor.conf
113           # disable liveness probe when breakpoints set in debugger
114           # so K8s doesn't restart unresponsive container
115           {{- if .Values.liveness.enabled }}
116           livenessProbe:
117             exec:
118               command:
119               - cat
120               - /usr/local/bin/healthy.sh
121             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
122             periodSeconds: {{ .Values.liveness.periodSeconds }}
123           readinessProbe:
124             exec:
125               command:
126               - cat
127               - /usr/local/bin/healthy.sh
128             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
129             periodSeconds: {{ .Values.readiness.periodSeconds }}
130           {{ end -}}
131           env:
132           volumeMounts:
133           - mountPath: /etc/localtime
134             name: localtime
135             readOnly: true
136           - mountPath: /usr/local/bin/conductor.conf
137             name: {{ .Values.global.commonConfigPrefix }}-config
138             subPath: conductor.conf
139           - mountPath: /usr/local/bin/log.conf
140             name: {{ .Values.global.commonConfigPrefix }}-config
141             subPath: log.conf
142           - mountPath: /usr/local/bin/healthy.sh
143             name: {{ .Values.global.commonConfigPrefix }}-config
144             subPath: healthy.sh
145           - mountPath: /usr/local/bin/AAF_RootCA.cer
146             name: {{ include "common.fullname" . }}-onap-certs
147             subPath: aaf_root_ca.cer
148           resources:
149 {{ include "common.resources" . | indent 12 }}
150         {{- if .Values.nodeSelector }}
151         nodeSelector:
152 {{ toYaml .Values.nodeSelector | indent 10 }}
153         {{- end -}}
154         {{- if .Values.affinity }}
155         affinity:
156 {{ toYaml .Values.affinity | indent 10 }}
157         {{- end }}
158       volumes:
159         - name: localtime
160           hostPath:
161             path: /etc/localtime
162         - name: {{ .Values.global.commonConfigPrefix }}-config
163           configMap:
164             name: {{ .Values.global.commonConfigPrefix }}-configmap
165             items:
166             - key: conductor.conf
167               path: conductor.conf
168             - key: log.conf
169               path: log.conf
170             - key: healthy.sh
171               path: healthy.sh
172 {{ include "oof.certificate.volume" . | indent 8 }}
173       imagePullSecrets:
174       - name: "{{ include "common.namespace" . }}-docker-registry-key"