87dd622c35315ff5d195d9c88910f1fb09a54f39
[oom.git] / kubernetes / common / network-name-gen / templates / deployment.yaml
1 {{/*
2 # Copyright (C) 2018  AT&T Intellectual Property.
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:
20   name: {{ include "common.fullname" . }}
21   namespace: {{ include "common.namespace" . }}
22   labels:
23     app: {{ include "common.name" . }}
24     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
25     release: {{ include "common.release" . }}
26     heritage: {{ .Release.Service }}
27 spec:
28   replicas: {{ .Values.replicaCount }}
29   selector:
30     matchLabels:
31       app: {{ include "common.name" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37     spec:
38       initContainers:
39 {{- if .Values.global.mariadbGalera.localCluster }}
40       - command:
41         - /root/ready.py
42         args:
43         - --container-name
44         - {{ index .Values "mariadb-galera" "nameOverride" }}
45 {{- else }}
46       - command:
47         - /root/job_complete.py
48         args:
49         - --job-name
50         - {{ include "common.release" . }}-{{ index .Values "mariadb-init" "nameOverride" }}-config-job
51 {{- end }}
52         env:
53         - name: NAMESPACE
54           valueFrom:
55             fieldRef:
56               apiVersion: v1
57               fieldPath: metadata.namespace
58         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         name: {{ include "common.name" . }}-readiness
61       containers:
62       - name: {{ include "common.name" . }}
63         command:
64           - bash
65         args:
66           - '-c'
67           - 'export POL_BASIC_AUTH=`echo -n $POL_BASIC_AUTH_USER:$POL_BASIC_AUTH_PASSWORD | base64`; /startService.sh'
68         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
69         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70         env:
71         - name: SPRING_PROFILE
72           value: "{{ .Values.config.springProfile }}"
73         - name: NENG_DB_USER
74           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
75         - name: NENG_DB_PASS
76           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
77         - name: NENG_DB_URL
78           value: jdbc:mysql://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
79         - name: POL_CLIENT_AUTH
80           value: "{{ .Values.config.polClientAuth }}"
81         - name: POL_BASIC_AUTH_USER
82           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "login") | indent 10}}
83         - name: POL_BASIC_AUTH_PASSWORD
84           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "password") | indent 10}}
85         - name: POL_URL
86           value: "{{ .Values.config.polUrl }}"
87         - name: POL_ENV
88           value: "{{ .Values.config.polEnv }}"
89         - name: POL_REQ_ID
90           value: "{{ .Values.config.polReqId }}"
91         - name: AAI_CERT_PASS
92           value: "{{ .Values.config.aaiCertPass }}"
93         - name: AAI_CERT_PATH
94           value: "{{ .Values.config.aaiCertPath }}"
95         - name: AAI_URI
96           value: "{{ .Values.config.aaiUri }}"
97         - name: AAI_AUTH
98           value: "{{ .Values.config.aaiAuth }}"
99         volumeMounts:
100         - name: certs
101           mountPath: /opt/etc/config/aai_keystore
102           subPath: aai_keystore
103           readOnly: true
104         resources:
105 {{ include "common.resources" . | indent 12 }}
106         {{- if .Values.nodeSelector }}
107         nodeSelector:
108 {{ toYaml .Values.nodeSelector | indent 10 }}
109         {{- end -}}
110         {{- if .Values.affinity }}
111         affinity:
112 {{ toYaml .Values.affinity | indent 10 }}
113         {{- end }}
114       volumes:
115       - name: certs
116         secret:
117             secretName: {{ include "common.release" . }}-aai-keystore
118       imagePullSecrets:
119       - name: "{{ include "common.namespace" . }}-docker-registry-key"