[SDNC] fix broken sdnc-web deployment
[oom.git] / kubernetes / sdnc / components / sdnc-web / templates / deployment.yaml
1 # Copyright © 2020 highstreet technologies GmbH
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: apps/v1
16 kind: Deployment
17 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
18 spec:
19   serviceName: "sdnc-web"
20   replicas: {{ .Values.replicaCount }}
21   selector: {{- include "common.selectors" . | nindent 4 }}
22   template:
23     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
24     spec:
25       initContainers: {{ include "common.certInitializer.initContainer" . | indent 6 }}
26       - name: {{ include "common.name" . }}-readiness
27         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
28         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
29         command:
30         - /app/ready.py
31         args:
32         - --container-name
33         - {{ .Values.config.sdncChartName }}
34         env:
35         - name: NAMESPACE
36           valueFrom:
37             fieldRef:
38               apiVersion: v1
39               fieldPath: metadata.namespace
40
41       containers:
42         - name: {{ include "common.name" . }}
43           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
44           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45           ports: {{- include "common.containerPorts" . | indent 10 }}
46           # disable liveness probe when breakpoints set in debugger
47           # so K8s doesn't restart unresponsive container
48           {{ if .Values.liveness.enabled }}
49           livenessProbe:
50             tcpSocket:
51               port: {{ .Values.service.internalPort }}
52             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
53             periodSeconds: {{ .Values.liveness.periodSeconds }}
54           {{ end }}
55           readinessProbe:
56             tcpSocket:
57               port: {{ .Values.service.internalPort }}
58             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
59             periodSeconds: {{ .Values.readiness.periodSeconds }}
60           env:
61           - name: WEBPROTOCOL
62             value: {{ .Values.config.webProtocol }}
63           - name: WEBPORT
64             value: {{ .Values.config.webPort | quote }}
65           - name: SDNRPROTOCOL
66             value: {{ .Values.config.sdnrProtocol }}
67           - name: SDNRHOST
68             value: {{ .Values.config.sdnrHost }}.{{ include "common.namespace" . }}
69           - name: SDNRPORT
70             value: {{ .Values.config.sdnrPort | quote }}
71           - name: SSL_CERT_DIR
72             value: {{ .Values.config.sslCertDir }}
73           - name: SSL_CERTIFICATE
74             value: {{ .Values.config.sslCertiticate }}
75           - name: SSL_CERTIFICATE_KEY
76             value: {{ .Values.config.sslCertKey }}
77           {{ if .Values.config.transportpce.enabled }}
78           - name: TRPCEURL
79             value: {{ .Values.config.transportpce.transportpceUrl }}
80           {{ end }}
81           {{ if .Values.config.topologyserver.enabled }}
82           - name: TOPOURL
83             value: {{ .Values.config.topologyserver.topologyserverUrl }}
84           - name: TILEURL
85             value: {{ .Values.config.topologyserver.tileserverUrl }}
86           {{ end }}
87
88           volumeMounts:  {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
89           - mountPath: /etc/localtime
90             name: localtime
91             readOnly: true
92
93           resources: {{ include "common.resources" . | nindent 12 }}
94         {{- if .Values.nodeSelector }}
95         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
96         {{- end -}}
97         {{- if .Values.affinity }}
98         affinity:
99 {{ toYaml .Values.affinity | indent 10 }}
100         {{- end }}
101       volumes: {{ include "common.certInitializer.volumes" . | nindent 6 }}
102       - name: localtime
103         hostPath:
104           path: /etc/localtime
105
106       imagePullSecrets:
107       - name: "{{ include "common.namespace" . }}-docker-registry-key"