[COMMON] Network-name-gen and dgbuilder ServiceMesh compatibility
[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       - name: {{ include "common.name" . }}-readiness
40         command:
41         - /app/ready.py
42         args:
43 {{- if .Values.global.mariadbGalera.localCluster }}
44         - --container-name
45         - {{ index .Values "mariadb-galera" "nameOverride" }}
46 {{- else }}
47         - --job-name
48         - {{ include "common.release" . }}-{{ index .Values "mariadb-init" "nameOverride" }}-config-job
49 {{- end }}
50         env:
51         - name: NAMESPACE
52           valueFrom:
53             fieldRef:
54               apiVersion: v1
55               fieldPath: metadata.namespace
56         image: {{ include "repositoryGenerator.image.readiness" . }}
57         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58       containers:
59       - name: {{ include "common.name" . }}
60         command:
61           - bash
62         args:
63           - '-c'
64           - 'export POL_BASIC_AUTH=`echo -n $POL_BASIC_AUTH_USER:$POL_BASIC_AUTH_PASSWORD | base64`; /startService.sh'
65         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         env:
68         - name: SPRING_PROFILE
69           value: "{{ .Values.config.springProfile }}"
70         - name: NENG_DB_USER
71           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
72         - name: NENG_DB_PASS
73           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
74         - name: NENG_DB_URL
75           value: jdbc:mysql://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "db" "name" }}
76         - name: POL_CLIENT_AUTH
77           value: "{{ .Values.config.polClientAuth }}"
78         - name: POL_BASIC_AUTH_USER
79           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "login") | indent 10}}
80         - name: POL_BASIC_AUTH_PASSWORD
81           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "password") | indent 10}}
82         - name: POL_URL
83           {{- if (include "common.needTLS" .) }}
84           value: "{{ .Values.config.polUrl.https }}"
85           {{- else }}
86           value: "{{ .Values.config.polUrl.http }}"
87           {{- end }}
88         - name: POL_ENV
89           value: "{{ .Values.config.polEnv }}"
90         - name: POL_REQ_ID
91           value: "{{ .Values.config.polReqId }}"
92         - name: AAI_CERT_PASS
93           value: "{{ .Values.config.aaiCertPass }}"
94         - name: AAI_CERT_PATH
95           value: "{{ .Values.config.aaiCertPath }}"
96         - name: AAI_URI
97           {{- if (include "common.needTLS" .) }}
98           value: "{{ .Values.config.aaiUri.https }}"
99           {{- else }}
100           value: "{{ .Values.config.aaiUri.http }}"
101           {{- end }}
102         - name: AAI_AUTH
103           value: "{{ .Values.config.aaiAuth }}"
104         - name: DISABLE_HOST_VERIFICATION
105           value: "{{ .Values.config.disableHostVerification }}"
106         volumeMounts:
107         - name: certs
108           mountPath: /opt/etc/config/aai_keystore
109           subPath: aai_keystore
110           readOnly: true
111         resources:
112 {{ include "common.resources" . | indent 12 }}
113         {{- if .Values.nodeSelector }}
114         nodeSelector:
115 {{ toYaml .Values.nodeSelector | indent 10 }}
116         {{- end -}}
117         {{- if .Values.affinity }}
118         affinity:
119 {{ toYaml .Values.affinity | indent 10 }}
120         {{- end }}
121       volumes:
122       - name: certs
123         secret:
124             secretName: {{ include "common.release" . }}-aai-keystore
125       imagePullSecrets:
126       - name: "{{ include "common.namespace" . }}-docker-registry-key"