[POLICY] Migration of clamp to policy area
[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         - command:
42           - sh
43           args:
44           - -c
45           - "cd /config-input && for PFILE in `ls -1 .`; do envsubst <${PFILE} >/config/${PFILE}; done"
46           env:
47           - name: KEYSTORE_PASSWORD
48             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "music-keystore-pw" "key" "password") | indent 12}}
49           - name: CASSA_USER
50             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "login") | indent 12 }}
51           - name: CASSA_PASSWORD
52             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cassa-secret" "key" "password") | indent 12 }}
53           volumeMounts:
54           - mountPath: /config-input
55             name: properties-music-scrubbed
56           - mountPath: /config
57             name: properties-music
58           image: {{ include "repositoryGenerator.image.envsubst" . }}
59           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60           name: {{ include "common.name" . }}-update-config
61       containers:
62         # MUSIC Container
63         - name: "{{ include "common.name" . }}-springboot"
64           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
65           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
66           ports: {{ include "common.containerPorts" . | nindent 12  }}
67           # disable liveness probe when breakpoints set in debugger
68           # so K8s doesn't restart unresponsive container
69           {{ if eq .Values.liveness.enabled true }}
70           livenessProbe:
71             tcpSocket:
72               port: {{ .Values.liveness.port }}
73             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.liveness.periodSeconds }}
75           {{ end -}}
76           readinessProbe:
77             tcpSocket:
78               port: {{ .Values.readiness.port }}
79             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.readiness.periodSeconds }}
81           resources:
82 {{ include "common.resources" . | indent 12 }}
83           env:
84           - name: SPRING_OPTS
85             value: "{{ .Values.springOpts }}"
86           - name: JAVA_OPTS
87             value: "{{ .Values.javaOpts }}"
88           - name: DEBUG
89             value: "{{ .Values.debug }}"
90           volumeMounts:
91           - name: localtime
92             mountPath: /etc/localtime
93             readOnly: true
94           - name: properties-music
95             mountPath: /opt/app/music/etc/music.properties
96             subPath: music.properties
97           - name: properties-music
98             mountPath: /opt/app/music/etc/music-sb.properties
99             subPath: music-sb.properties
100           - name: properties-music-scrubbed
101             mountPath: /opt/app/music/etc/logback.xml
102             subPath: logback.xml
103           - name: certs-aaf
104             mountPath: /opt/app/aafcertman/
105       volumes:
106         - name: shared-data
107           emptyDir: {}
108         - name: certificate-vol
109           emptyDir: {}
110         - name: localtime
111           hostPath:
112             path: /etc/localtime
113         - name: properties-music-scrubbed
114           configMap:
115             name: {{ include "common.fullname" . }}
116         - name: properties-music
117           emptyDir:
118             medium: Memory
119         - name: certs-aaf
120           secret:
121             secretName: {{ include "common.secret.getSecretNameFast" (dict "global" . "uid" "music-certs") }}