Merge "[COMMON] Update words whitelist URL"
[oom.git] / kubernetes / common / music / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017-2020 AT&T, Amdocs, Bell Canada
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
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   selector: {{- include "common.selectors" . | nindent 4 }}
22   replicas: {{ .Values.replicaCount }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       initContainers:
27         - name: {{ include "common.name" . }}-cassandra-readiness
28           image: {{ include "repositoryGenerator.image.readiness" . }}
29           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
30           command:
31           - /app/ready.py
32           args:
33           - -j
34           - "{{ include "common.release" . }}-music-cassandra-config"
35           env:
36           - name: NAMESPACE
37             valueFrom:
38               fieldRef:
39                 apiVersion: v1
40                 fieldPath: metadata.namespace
41         {{ include "common.certInitializer.initContainer" . | indent 8 | trim }}
42         - command:
43           - sh
44           args:
45           - -c
46           - "export KEYSTORE_PASSWORD=$(cat /opt/app/aafcertman/local/.pass); cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
47           env:
48           - name: CASSA_USER
49             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "login") | indent 12 }}
50           - name: CASSA_PASSWORD
51             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "password") | indent 12 }}
52           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
53           - mountPath: /config-input
54             name: properties-music-scrubbed
55           - mountPath: /config
56             name: properties-music
57           image: {{ include "repositoryGenerator.image.envsubst" . }}
58           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59           name: {{ include "common.name" . }}-update-config
60       containers:
61         # MUSIC Container
62         - name: "{{ include "common.name" . }}-springboot"
63           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
64           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65           ports: {{ include "common.containerPorts" . | nindent 12  }}
66           # disable liveness probe when breakpoints set in debugger
67           # so K8s doesn't restart unresponsive container
68           {{ if eq .Values.liveness.enabled true }}
69           livenessProbe:
70             tcpSocket:
71               port: {{ .Values.liveness.port }}
72             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
73             periodSeconds: {{ .Values.liveness.periodSeconds }}
74           {{ end -}}
75           readinessProbe:
76             tcpSocket:
77               port: {{ .Values.readiness.port }}
78             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
79             periodSeconds: {{ .Values.readiness.periodSeconds }}
80           resources:
81 {{ include "common.resources" . | indent 12 }}
82           env:
83           - name: SPRING_OPTS
84             value: "{{ .Values.springOpts }}"
85           - name: JAVA_OPTS
86             value: "{{ .Values.javaOpts }}"
87           - name: DEBUG
88             value: "{{ .Values.debug }}"
89           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
90           - name: localtime
91             mountPath: /etc/localtime
92             readOnly: true
93           - name: properties-music
94             mountPath: /opt/app/music/etc/music.properties
95             subPath: music.properties
96           - name: properties-music
97             mountPath: /opt/app/music/etc/music-sb.properties
98             subPath: music-sb.properties
99           - name: properties-music-scrubbed
100             mountPath: /opt/app/music/etc/logback.xml
101             subPath: logback.xml
102       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
103         - name: shared-data
104           emptyDir: {}
105         - name: certificate-vol
106           emptyDir: {}
107         - name: localtime
108           hostPath:
109             path: /etc/localtime
110         - name: properties-music-scrubbed
111           configMap:
112             name: {{ include "common.fullname" . }}
113         - name: properties-music
114           emptyDir:
115             medium: Memory