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