c3b30b22b7901cf42b191f7f24cd82dd242f80bd
[oom.git] / kubernetes / common / music / charts / music / templates / deployment.yaml
1 # Copyright © 2017-2020 AT&T, Amdocs, Bell Canada
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: apps/v1
16 kind: Deployment
17 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
18 spec:
19   selector: {{- include "common.selectors" . | nindent 4 }}
20   replicas: {{ .Values.replicaCount }}
21   template:
22     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
23     spec:
24       initContainers:
25         - name: {{ include "common.name" . }}-cassandra-readiness
26           image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
27           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
28           command:
29           - /root/job_complete.py
30           args:
31           - -j
32           - "{{ include "common.release" . }}-music-cassandra-job-config"
33           env:
34           - name: NAMESPACE
35             valueFrom:
36               fieldRef:
37                 apiVersion: v1
38                 fieldPath: metadata.namespace
39         - command:
40           - sh
41           args:
42           - -c
43           - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
44           env:
45           - name: KEYSTORE_PASSWORD
46             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-keystore-pw" "key" "password") | indent 12}}
47           - name: CASSA_USER
48             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "login") | indent 12 }}
49           - name: CASSA_PASSWORD
50             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "password") | indent 12 }}
51           volumeMounts:
52           - mountPath: /config-input
53             name: properties-music-scrubbed
54           - mountPath: /config
55             name: properties-music
56           image: "{{ .Values.global.envsubstImage }}"
57           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58           name: {{ include "common.name" . }}-update-config
59       containers:
60         # MUSIC Container
61         - name: "{{ include "common.name" . }}-springboot"
62           image: "{{ .Values.repository }}/{{ .Values.image }}"
63           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64           ports: {{ include "common.containerPorts" . | nindent 12  }}
65           # disable liveness probe when breakpoints set in debugger
66           # so K8s doesn't restart unresponsive container
67           {{ if eq .Values.liveness.enabled true }}
68           livenessProbe:
69             tcpSocket:
70               port: {{ .Values.liveness.port }}
71             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.liveness.periodSeconds }}
73           {{ end -}}
74           readinessProbe:
75             tcpSocket:
76               port: {{ .Values.readiness.port }}
77             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
78             periodSeconds: {{ .Values.readiness.periodSeconds }}
79           resources:
80 {{ toYaml .Values.resources | indent 12 }}
81           env:
82           - name: SPRING_OPTS
83             value: "{{ .Values.springOpts }}"
84           - name: JAVA_OPTS
85             value: "{{ .Values.javaOpts }}"
86           - name: DEBUG
87             value: "{{ .Values.debug }}"
88           volumeMounts:
89           - name: localtime
90             mountPath: /etc/localtime
91             readOnly: true
92           - name: properties-music
93             mountPath: /opt/app/music/etc/music.properties
94             subPath: music.properties
95           - name: properties-music
96             mountPath: /opt/app/music/etc/music-sb.properties
97             subPath: music-sb.properties
98           - name: properties-music-scrubbed
99             mountPath: /opt/app/music/etc/logback.xml
100             subPath: logback.xml
101           - name: certs-aaf
102             mountPath: /opt/app/aafcertman/
103       volumes:
104         - name: shared-data
105           emptyDir: {}
106         - name: certificate-vol
107           emptyDir: {}
108         - name: localtime
109           hostPath:
110             path: /etc/localtime
111         - name: properties-music-scrubbed
112           configMap:
113             name: {{ include "common.fullname" . }}
114         - name: properties-music
115           emptyDir:
116             medium: Memory
117         - name: certs-aaf
118           secret:
119             secretName: {{ include "common.secret.getSecretNameFast" (dict "global" . "uid" "music-certs") }}