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