Merge "HTTPS/AAF auto cert gen for Portal SDK"
[oom.git] / kubernetes / common / network-name-gen / templates / deployment.yaml
1 # Copyright (C) 2018  AT&T Intellectual Property.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32     spec:
33       initContainers:
34 {{- if .Values.global.mariadbGalera.localCluster }}
35       - command:
36         - /root/ready.py
37         args:
38         - --container-name
39         - {{ index .Values "mariadb-galera" "nameOverride" }}
40 {{- else }}
41       - command:
42         - /root/job_complete.py
43         args:
44         - --job-name
45         - {{ include "common.release" . }}-{{ index .Values "mariadb-init" "nameOverride" }}-config-job
46 {{- end }}
47         env:
48         - name: NAMESPACE
49           valueFrom:
50             fieldRef:
51               apiVersion: v1
52               fieldPath: metadata.namespace
53         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         name: {{ include "common.name" . }}-readiness
56       containers:
57       - name: {{ include "common.name" . }}
58         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         env:
61         - name: SPRING_PROFILE
62           value: "{{ .Values.config.springProfile }}"
63         - name: NENG_DB_USER
64           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
65         - name: NENG_DB_PASS
66           {{- include "common.secret.envFromSecret" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
67         - name: NENG_DB_URL
68           value: jdbc:mysql://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
69         - name: POL_CLIENT_AUTH
70           value: "{{ .Values.config.polClientAuth }}"
71         - name: POL_BASIC_AUTH
72           value: "{{ .Values.config.polBasicAuth }}"
73         - name: POL_URL
74           value: "{{ .Values.config.polUrl }}"
75         - name: POL_ENV
76           value: "{{ .Values.config.polEnv }}"
77         - name: POL_REQ_ID
78           value: "{{ .Values.config.polReqId }}"
79         - name: AAI_CERT_PASS
80           value: "{{ .Values.config.aaiCertPass }}"
81         - name: AAI_CERT_PATH
82           value: "{{ .Values.config.aaiCertPath }}"
83         - name: AAI_URI
84           value: "{{ .Values.config.aaiUri }}"
85         - name: AAI_AUTH
86           value: "{{ .Values.config.aaiAuth }}"
87         volumeMounts:
88         - name: certs
89           mountPath: /opt/etc/config/aai_keystore
90           subPath: aai_keystore
91           readOnly: true
92         resources:
93 {{ include "common.resources" . | indent 12 }}
94         {{- if .Values.nodeSelector }}
95         nodeSelector:
96 {{ toYaml .Values.nodeSelector | indent 10 }}
97         {{- end -}}
98         {{- if .Values.affinity }}
99         affinity:
100 {{ toYaml .Values.affinity | indent 10 }}
101         {{- end }}
102       volumes:
103       - name: certs
104         secret:
105             secretName: {{ include "common.release" . }}-aai-keystore
106       imagePullSecrets:
107       - name: "{{ include "common.namespace" . }}-docker-registry-key"