1eed35c0c5ba3f87437677b4af7767a5097bcfdd
[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: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   selector: {{- include "common.selectors" . | nindent 4 }}
22   replicas: {{ .Values.replicaCount }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       initContainers:
27       - name: {{ include "common.name" . }}-readiness
28         command:
29         - /app/ready.py
30         args:
31 {{- if .Values.global.mariadbGalera.localCluster }}
32         - --app-name
33         - {{ index .Values "mariadb-galera" "nameOverride" }}
34 {{- else }}
35         - --job-name
36         - {{ include "common.release" . }}-{{ index .Values "mariadb-init" "nameOverride" }}-config-job
37 {{- end }}
38         env:
39         - name: NAMESPACE
40           valueFrom:
41             fieldRef:
42               apiVersion: v1
43               fieldPath: metadata.namespace
44         image: {{ include "repositoryGenerator.image.readiness" . }}
45         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
46       containers:
47       - name: {{ include "common.name" . }}
48         command:
49           - bash
50         args:
51           - '-c'
52           - 'export POL_BASIC_AUTH=`echo -n $POL_BASIC_AUTH_USER:$POL_BASIC_AUTH_PASSWORD | base64`; /startService.sh'
53         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         env:
56         - name: SPRING_PROFILE
57           value: "{{ .Values.config.springProfile }}"
58         - name: NENG_DB_USER
59           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "login") | indent 10}}
60         - name: NENG_DB_PASS
61           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "neng-db-secret" "key" "password") | indent 10}}
62         - name: NENG_DB_URL
63           value: jdbc:mysql://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "db" "name" }}
64         - name: POL_CLIENT_AUTH
65           value: "{{ .Values.config.polClientAuth }}"
66         - name: POL_BASIC_AUTH_USER
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "login") | indent 10}}
68         - name: POL_BASIC_AUTH_PASSWORD
69           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pol-basic-auth-secret" "key" "password") | indent 10}}
70         - name: POL_URL
71           {{- if (include "common.needTLS" .) }}
72           value: "{{ .Values.config.polUrl.https }}"
73           {{- else }}
74           value: "{{ .Values.config.polUrl.http }}"
75           {{- end }}
76         - name: POL_ENV
77           value: "{{ .Values.config.polEnv }}"
78         - name: POL_REQ_ID
79           value: "{{ .Values.config.polReqId }}"
80         - name: AAI_CERT_PASS
81           value: "{{ .Values.config.aaiCertPass }}"
82         - name: AAI_CERT_PATH
83           value: "{{ .Values.config.aaiCertPath }}"
84         - name: AAI_URI
85           {{- if (include "common.needTLS" .) }}
86           value: "{{ .Values.config.aaiUri.https }}"
87           {{- else }}
88           value: "{{ .Values.config.aaiUri.http }}"
89           {{- end }}
90         - name: AAI_AUTH
91           value: "{{ .Values.config.aaiAuth }}"
92         - name: DISABLE_HOST_VERIFICATION
93           value: "{{ .Values.config.disableHostVerification }}"
94         volumeMounts:
95         - name: certs
96           mountPath: /opt/etc/config/aai_keystore
97           subPath: aai_keystore
98           readOnly: true
99         resources: {{ include "common.resources" . | nindent 10 }}
100         {{- if .Values.nodeSelector }}
101         nodeSelector:
102 {{ toYaml .Values.nodeSelector | indent 10 }}
103         {{- end -}}
104         {{- if .Values.affinity }}
105         affinity:
106 {{ toYaml .Values.affinity | indent 10 }}
107         {{- end }}
108       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
109       volumes:
110       - name: certs
111         secret:
112             secretName: {{ include "common.release" . }}-aai-keystore
113       imagePullSecrets:
114       - name: "{{ include "common.namespace" . }}-docker-registry-key"