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