Update git submodules
[oom.git] / kubernetes / policy / charts / brmsgw / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 AT&T
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:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   selector:
28     matchLabels:
29       app: {{ include "common.name" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36     spec:
37       initContainers:
38       - command:
39         - sh
40         args:
41         - -c
42         - "cd /config-input && for PFILE in `find . -not -type d | grep -v -F ..`; do envsubst <${PFILE} >/config/${PFILE}; chmod 0755 /config/${PFILE}; done"
43         env:
44         - name: JDBC_USER
45           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
46         - name: JDBC_PASSWORD
47           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
48         - name: PDP_HTTP_USER_ID
49           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pdp-http-creds" "key" "login") | indent 10 }}
50         - name: PDP_HTTP_PASSWORD
51           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pdp-http-creds" "key" "password") | indent 10 }}
52         - name: PDP_PAP_PDP_HTTP_USER_ID
53           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pap-http-creds" "key" "login") | indent 10 }}
54         - name: PDP_PAP_PDP_HTTP_PASSWORD
55           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pap-http-creds" "key" "password") | indent 10 }}
56         - name: REPOSITORY_USERNAME
57           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nexus-creds" "key" "login") | indent 10 }}
58         - name: REPOSITORY_PASSWORD
59           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nexus-creds" "key" "password") | indent 10 }}
60         volumeMounts:
61         - mountPath: /config-input/pe
62           name: pe-input
63         - mountPath: /config-input/pe-brmsgw
64           name: pe-brmsgw-input
65         - mountPath: /config/pe
66           name: pe
67         - mountPath: /config/pe-brmsgw
68           name: pe-brmsgw
69         image: "{{ .Values.global.envsubstImage }}"
70         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
71         name: {{ include "common.name" . }}-update-config
72       - command:
73         - /root/ready.py
74         args:
75         - --container-name
76         - {{ .Values.global.pap.nameOverride }}
77         env:
78         - name: NAMESPACE
79           valueFrom:
80             fieldRef:
81               apiVersion: v1
82               fieldPath: metadata.namespace
83         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
84         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
85         name: {{ include "common.name" . }}-readiness
86       containers:
87       - command:
88         - /bin/bash
89         - ./do-start.sh
90         - brmsgw
91         name: {{ include "common.name" . }}
92         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
93         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94         env:
95         - name: JDBC_USER
96           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
97         - name: JDBC_PASSWORD
98           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
99         - name: PDP_HTTP_USER_ID
100           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pdp-http-creds" "key" "login") | indent 10 }}
101         - name: PDP_HTTP_PASSWORD
102           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pdp-http-creds" "key" "password") | indent 10 }}
103         - name: PDP_PAP_PDP_HTTP_USER_ID
104           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pap-http-creds" "key" "login") | indent 10 }}
105         - name: PDP_PAP_PDP_HTTP_PASSWORD
106           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pap-http-creds" "key" "password") | indent 10 }}
107         - name: REPOSITORY_USERNAME
108           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nexus-creds" "key" "login") | indent 10 }}
109         - name: REPOSITORY_PASSWORD
110           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nexus-creds" "key" "password") | indent 10 }}
111         ports:
112         - containerPort: {{ .Values.service.externalPort }}
113         {{- if eq .Values.liveness.enabled true }}
114         livenessProbe:
115           tcpSocket:
116             port: {{ .Values.service.externalPort }}
117           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
118           periodSeconds: {{ .Values.liveness.periodSeconds }}
119         {{- end }}
120         readinessProbe:
121           tcpSocket:
122             port: {{ .Values.service.externalPort }}
123           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
124           periodSeconds: {{ .Values.readiness.periodSeconds }}
125         volumeMounts:
126         - mountPath: /etc/localtime
127           name: localtime
128           readOnly: true
129         - mountPath: /tmp/policy-install/config/brmsgw-tweaks.sh
130           name: pe-brmsgw
131           subPath: brmsgw-tweaks.sh
132         - mountPath: /tmp/policy-install/config/brmsgw.conf
133           name: pe-brmsgw
134           subPath: brmsgw.conf
135         - mountPath: /tmp/policy-install/config/base.conf
136           name: pe
137           subPath: base.conf
138         - mountPath: /tmp/policy-install/do-start.sh
139           name: pe-scripts
140           subPath: do-start.sh
141         resources:
142 {{ include "common.resources" . | indent 12 }}
143       {{- if .Values.nodeSelector }}
144       nodeSelector:
145 {{ toYaml .Values.nodeSelector | indent 10 }}
146       {{- end -}}
147       {{- if .Values.affinity }}
148       affinity:
149 {{ toYaml .Values.affinity | indent 10 }}
150       {{- end }}
151       volumes:
152         - name: localtime
153           hostPath:
154             path: /etc/localtime
155         - name: pe-input
156           configMap:
157             name: {{ include "common.release" . }}-pe-configmap
158             defaultMode: 0755
159         - name: pe-scripts
160           configMap:
161             name: {{ include "common.release" . }}-pe-scripts-configmap
162             defaultMode: 0777
163         - name: pe-brmsgw-input
164           configMap:
165             name: {{ include "common.fullname" . }}-pe-configmap
166             defaultMode: 0755
167         - name: pe
168           emptyDir:
169             medium: Memory
170         - name: pe-brmsgw
171           emptyDir:
172             medium: Memory
173       imagePullSecrets:
174       - name: "{{ include "common.namespace" . }}-docker-registry-key"