Merge "Remove unneded LoadBalancer annotation"
[oom.git] / kubernetes / sdc / charts / sdc-be / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, AT&T, Bell Canada
2 # Modifications Copyright © 2018 ZTE
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: apps/v1
17 kind: Deployment
18 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
19 spec:
20   selector: {{- include "common.selectors" . | nindent 4 }}
21   replicas: {{ .Values.replicaCount }}
22   template:
23     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
24     spec:
25       initContainers:
26       - name: {{ include "common.name" . }}-readiness
27         command:
28         - /root/ready.py
29         args:
30         - --container-name
31         - "sdc-onboarding-be"
32         env:
33         - name: NAMESPACE
34           valueFrom:
35             fieldRef:
36               apiVersion: v1
37               fieldPath: metadata.namespace
38         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
39         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40       - name: {{ include "common.name" . }}-job-completion
41         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
42         imagePullPolicy: "{{ .Values.global.pullPolicy | default .Values.pullPolicy }}"
43         command:
44         - /root/job_complete.py
45         args:
46         - --job-name
47         - {{ include "common.release" . }}-sdc-onboarding-be-cassandra-init
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54       containers:
55         - name: {{ include "common.name" . }}
56           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           ports: {{ include "common.containerPorts" . | nindent 10  }}
59           {{ if eq .Values.liveness.enabled true }}
60           livenessProbe:
61             httpGet:
62               path: /sdc2/rest/healthCheck
63               port: {{ .Values.liveness.port }}
64               scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
65             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.liveness.periodSeconds }}
67             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
68           {{ end }}
69           readinessProbe:
70             exec:
71               command:
72               - "/var/lib/jetty/ready-probe.sh"
73             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.readiness.periodSeconds }}
75             timeoutSeconds: {{ .Values.readiness.timeoutSeconds }}
76           resources: {{ include "common.resources" . | nindent 12 }}
77           env:
78           - name: ENVNAME
79             value: {{ .Values.global.env.name }}
80           - name: JAVA_OPTIONS
81             value: {{ .Values.config.javaOptions }}
82           - name: cassandra_ssl_enabled
83             value: {{ .Values.config.cassandraSslEnabled | quote }}
84           - name: HOST_IP
85             valueFrom:
86               fieldRef:
87                 fieldPath: status.podIP
88           volumeMounts:
89           - name: {{ include "common.fullname" . }}-environments
90             mountPath: /var/lib/jetty/chef-solo/environments/
91           - name: {{ include "common.fullname" . }}-localtime
92             mountPath: /etc/localtime
93             readOnly: true
94           - name: {{ include "common.fullname" . }}-logs
95             mountPath: /var/log/onap
96           - name: {{ include "common.fullname" . }}-logback
97             mountPath: /tmp/logback.xml
98             subPath: logback.xml
99           lifecycle:
100             postStart:
101               exec:
102                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/var/lib/jetty/config/catalog-be/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
103         # side car containers
104         - name: {{ include "common.name" . }}-filebeat-onap
105           image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
106           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
107           volumeMounts:
108           - name: {{ include "common.fullname" . }}-filebeat-conf
109             mountPath: /usr/share/filebeat/filebeat.yml
110             subPath: filebeat.yml
111           - name: {{ include "common.fullname" . }}-logs
112             mountPath: /var/log/onap
113           - name: {{ include "common.fullname" . }}-data-filebeat
114             mountPath: /usr/share/filebeat/data
115       volumes:
116       - name: {{ include "common.fullname" . }}-localtime
117         hostPath:
118           path: /etc/localtime
119       - name: {{ include "common.fullname" . }}-filebeat-conf
120         configMap:
121           name: {{ include "common.release" . }}-sdc-filebeat-configmap
122       - name: {{ include "common.fullname" . }}-data-filebeat
123         emptyDir: {}
124       - name: {{ include "common.fullname" . }}-logback
125         configMap:
126           name : {{ include "common.fullname" . }}-logging-configmap
127       - name: {{ include "common.fullname" . }}-environments
128         configMap:
129           name: {{ include "common.release" . }}-sdc-environments-configmap
130           defaultMode: 0755
131       - name:  {{ include "common.fullname" . }}-logs
132         emptyDir: {}
133       imagePullSecrets:
134       - name: "{{ include "common.namespace" . }}-docker-registry-key"