Merge "[VID] Automatically retrieve certificates"
[oom.git] / kubernetes / vid / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Copyright © 2020 Samsung Electronics
4 # Copyright © 2021 Orange
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 */}}
18
19 apiVersion: apps/v1
20 kind: Deployment
21 metadata:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ include "common.release" . }}
28     heritage: {{ .Release.Service }}
29 spec:
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   replicas: {{ .Values.replicaCount }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
41       - command:
42         - /app/ready.py
43         args:
44         - --job-name
45         - {{ include "common.fullname" . }}-mariadb-init-config-job
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52         image: {{ include "repositoryGenerator.image.readiness" . }}
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         name: {{ include "common.name" . }}-readiness
55       containers:
56         - name: {{ include "common.name" . }}
57           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
58           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
59           {{- if .Values.global.aafEnabled }}
60           command:
61           - sh
62           args:
63           - -c
64           - |
65             export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
66             /tmp/vid/localize.sh
67           {{- end }}
68           ports:
69           - containerPort: {{ .Values.service.internalPort }}
70           # disable liveness probe when breakpoints set in debugger
71           # so K8s doesn't restart unresponsive container
72           {{- if eq .Values.liveness.enabled true }}
73           livenessProbe:
74             tcpSocket:
75               port: {{ .Values.service.internalPort }}
76             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
77             periodSeconds: {{ .Values.liveness.periodSeconds }}
78           {{ end -}}
79           readinessProbe:
80             tcpSocket:
81               port: {{ .Values.service.internalPort }}
82             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
83             periodSeconds: {{ .Values.readiness.periodSeconds }}
84           env:
85             - name: ASDC_CLIENT_REST_HOST
86               value: sdc-be.{{ include "common.namespace" . }}
87             - name: ASDC_CLIENT_REST_AUTH
88               value: "{{ .Values.config.asdcclientrestauth }}"
89             - name: ASDC_CLIENT_REST_PORT
90               value: "{{ .Values.config.asdcclientrestport }}"
91             - name: ASDC_CLIENT_REST_PROTOCOL
92               value: "https"
93             - name: VID_AAI_URL
94               value: https://aai.{{ include "common.namespace" . }}:{{ .Values.config.vidaaiport }}
95             - name: VID_ECOMP_SHARED_CONTEXT_REST_URL
96               value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/context
97             - name: VID_MSO_SERVER_URL
98               value: http://so.{{ include "common.namespace" . }}:{{ .Values.config.msoport }}/onap/so/infra
99             - name: VID_MSO_PASS
100               value: "{{ .Values.config.vidmsopass }}"
101             - name: MSO_DME2_SERVER_URL
102               value: "{{ .Values.config.msodme2serverurl }}"
103             - name: MSO_DME2_ENABLED
104               value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }}
105             - name: VID_ECOMP_REDIRECT_URL
106               value: https://{{ .Values.config.portalhost }}:{{ .Values.config.onapport }}/ONAPPORTAL/login.htm
107             - name: VID_ECOMP_REST_URL
108               value: https://portal-app:{{ .Values.config.onapportrest }}/ONAPPORTAL/auxapi
109             - name: VID_ROLE_ACCESS_CENTRALIZED
110               value: "{{ .Values.config.roleaccesscentralized }}"
111             - name: VID_CONTACT_US_LINK
112               value: "{{ .Values.config.vidcontactuslink }}"
113             - name: VID_UEB_URL_LIST
114               value: message-router.{{ include "common.namespace" . }}
115             - name: VID_MYSQL_HOST
116               value: {{  include "common.mariadbService" . }}
117             - name: VID_MYSQL_PORT
118               value: "{{ include "common.mariadbPort" . }}"
119             - name: VID_MYSQL_DBNAME
120               value: {{ index .Values "mariadb-galera" "db" "name" }}
121             - name: VID_MYSQL_USER
122               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "login") | indent 14 }}
123             - name: VID_MYSQL_PASS
124               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "vid-db-user-secret" "key" "password") | indent 14 }}
125             - name: VID_MYSQL_MAXCONNECTIONS
126               value: "{{ .Values.config.vidmysqlmaxconnections }}"
127             {{- if .Values.global.aafEnabled }}
128             - name: VID_KEYSTORE_FILENAME
129               value: "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.fqi_namespace }}.jks"
130             - name: VID_TRUSTSTORE_FILENAME
131               value: "{{ .Values.certInitializer.credsPath }}/{{ .Values.certInitializer.fqi_namespace }}.trust.jks"
132             {{- end }}
133           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
134           - mountPath: /etc/localtime
135             name: localtime
136             readOnly: true
137           - mountPath: /var/log/onap
138             name: vid-logs
139           - mountPath: /tmp/logback.xml
140             name: vid-logback
141             subPath: logback.xml
142           resources:
143 {{ include "common.resources" . | indent 12 }}
144         {{- if .Values.nodeSelector }}
145         nodeSelector:
146 {{ toYaml .Values.nodeSelector | indent 10 }}
147         {{- end -}}
148         {{- if .Values.affinity }}
149         affinity:
150 {{ toYaml .Values.affinity | indent 10 }}
151         {{- end }}
152       # side car containers
153         - name: filebeat-onap
154           image: {{ include "repositoryGenerator.image.logging" . }}
155           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
156           volumeMounts:
157           - mountPath: /usr/share/filebeat/filebeat.yml
158             name: filebeat-conf
159             subPath: filebeat.yml
160           - mountPath: /var/log/onap
161             name: vid-logs
162           - mountPath: /usr/share/filebeat/data
163             name: vid-data-filebeat
164       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
165         - name: localtime
166           hostPath:
167             path: /etc/localtime
168         - name: filebeat-conf
169           configMap:
170             name: {{ include "common.fullname" . }}-filebeat-configmap
171         - name: vid-logs
172           emptyDir: {}
173         - name: vid-data-filebeat
174           emptyDir: {}
175         - name: vid-logback
176           configMap:
177             name: {{ include "common.fullname" . }}-log-configmap
178       imagePullSecrets:
179       - name: "{{ include "common.namespace" . }}-docker-registry-key"