blob: c6cf2d150d88f024bfe07b971ee7fbd8a584e829 [file] [log] [blame]
Jakub Latusekbe896842020-10-21 13:36:29 +02001{{/*
Prateekinlinux445a18e2018-08-01 06:48:33 +00002# Copyright © 2018 Amdocs, Bell Canada , ZTE
Sylvain Desbureaux55af6482020-11-02 18:21:11 +01003# Copyright © 2021 Orange
Prateekinlinux445a18e2018-08-01 06:48:33 +00004#
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.
Jakub Latusekbe896842020-10-21 13:36:29 +020016*/}}
Grzegorz-Lis055b6ce2020-07-23 10:03:54 +020017apiVersion: apps/v1
BorislavG0433c912018-03-21 18:35:30 +020018kind: Deployment
Andreas Geissler8d87db22022-09-15 21:14:00 +020019metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
BorislavG0433c912018-03-21 18:35:30 +020020spec:
Andreas Geissler8d87db22022-09-15 21:14:00 +020021 selector: {{- include "common.selectors" . | nindent 4 }}
BorislavG0433c912018-03-21 18:35:30 +020022 replicas: {{ .Values.replicaCount }}
23 template:
Andreas Geissler8d87db22022-09-15 21:14:00 +020024 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
BorislavG0433c912018-03-21 18:35:30 +020025 spec:
26 initContainers:
Sylvain Desbureaux55af6482020-11-02 18:21:11 +010027 {{ include "common.certInitializer.initContainer" . | indent 6 | trim }}
BorislavG0433c912018-03-21 18:35:30 +020028 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020029 - /app/ready.py
BorislavG0433c912018-03-21 18:35:30 +020030 args:
31 - --container-name
32 - msb-discovery
33 env:
34 - name: NAMESPACE
35 valueFrom:
36 fieldRef:
37 apiVersion: v1
38 fieldPath: metadata.namespace
Sylvain Desbureauxfd2f8b82020-11-21 22:50:06 +010039 image: {{ include "repositoryGenerator.image.readiness" . }}
BorislavG0433c912018-03-21 18:35:30 +020040 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
41 name: {{ include "common.name" . }}-readiness
42 containers:
43 - name: {{ include "common.name" . }}
Sylvain Desbureauxfd2f8b82020-11-21 22:50:06 +010044 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
BorislavG0433c912018-03-21 18:35:30 +020045 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Andreas Geissler8d87db22022-09-15 21:14:00 +020046 ports: {{- include "common.containerPorts" . | indent 10 }}
BorislavG0433c912018-03-21 18:35:30 +020047 # disable liveness probe when breakpoints set in debugger
48 # so K8s doesn't restart unresponsive container
49 {{- if eq .Values.liveness.enabled true }}
50 livenessProbe:
51 tcpSocket:
Andreas Geissler8d87db22022-09-15 21:14:00 +020052 port: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.internalPort .Values.service.internalPlainPort }}
BorislavG0433c912018-03-21 18:35:30 +020053 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
54 periodSeconds: {{ .Values.liveness.periodSeconds }}
55 {{ end -}}
56 readinessProbe:
57 tcpSocket:
Andreas Geissler8d87db22022-09-15 21:14:00 +020058 port: {{ (eq "true" (include "common.needTLS" .)) | ternary .Values.service.internalPort .Values.service.internalPlainPort }}
BorislavG0433c912018-03-21 18:35:30 +020059 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
60 periodSeconds: {{ .Values.readiness.periodSeconds }}
61 env:
62 - name: CONSUL_IP
BorislavG6c7ecf02018-04-01 13:08:37 +030063 value: msb-consul.{{ include "common.namespace" . }}
BorislavG0433c912018-03-21 18:35:30 +020064 - name: SDCLIENT_IP
BorislavG6c7ecf02018-04-01 13:08:37 +030065 value: msb-discovery.{{ include "common.namespace" . }}
BorislavG0433c912018-03-21 18:35:30 +020066 - name: ROUTE_LABELS
67 value: {{ .Values.config.routeLabels }}
68 volumeMounts:
Sylvain Desbureaux55af6482020-11-02 18:21:11 +010069 {{ include "common.certInitializer.volumeMount" . | indent 10 | trim }}
BorislavG0433c912018-03-21 18:35:30 +020070 - mountPath: /etc/localtime
71 name: localtime
72 readOnly: true
LiZi4dd8e112018-04-09 07:34:04 -040073 - mountPath: /usr/local/apiroute-works/logs
Li Zic5290dc2018-08-06 09:26:27 +000074 name: {{ include "common.fullname" . }}-logs
Andreas Geissler8d87db22022-09-15 21:14:00 +020075 {{- if (include "common.needTLS" .) }}
Sylvain Desbureaux55af6482020-11-02 18:21:11 +010076 - mountPath: /usr/local/openresty/nginx/msb-enabled/msbhttps.conf
77 name: {{ include "common.fullname" . }}-nginx-conf
78 subPath: msbhttps.conf
Andreas Geissler8d87db22022-09-15 21:14:00 +020079 {{- end }}
BorislavG0433c912018-03-21 18:35:30 +020080 resources:
Mandeep Khinda5e3f36a2018-09-24 15:25:42 +000081{{ include "common.resources" . | indent 12 }}
BorislavG0433c912018-03-21 18:35:30 +020082 {{- if .Values.nodeSelector }}
83 nodeSelector:
84{{ toYaml .Values.nodeSelector | indent 10 }}
85 {{- end -}}
86 {{- if .Values.affinity }}
87 affinity:
88{{ toYaml .Values.affinity | indent 10 }}
89 {{- end }}
LiZi4dd8e112018-04-09 07:34:04 -040090 # side car containers
Maciej Wereski0763e6e2021-11-18 11:48:25 +010091 {{ include "common.log.sidecar" . | nindent 8 }}
farida azmya4478e82021-10-11 13:48:11 +020092 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
BorislavG0433c912018-03-21 18:35:30 +020093 volumes:
Sylvain Desbureaux55af6482020-11-02 18:21:11 +010094 {{ include "common.certInitializer.volumes" . | indent 8 | trim }}
Li Zic5290dc2018-08-06 09:26:27 +000095 - name: {{ include "common.fullname" . }}-log-conf
96 configMap:
97 name: {{ include "common.fullname" . }}-log
Andreas Geissler8d87db22022-09-15 21:14:00 +020098 {{- if (include "common.needTLS" .) }}
Sylvain Desbureaux55af6482020-11-02 18:21:11 +010099 - name: {{ include "common.fullname" . }}-nginx-conf
100 configMap:
101 name: {{ include "common.fullname" . }}-nginx
Andreas Geissler8d87db22022-09-15 21:14:00 +0200102 {{- end }}
Maciej Wereski0763e6e2021-11-18 11:48:25 +0100103 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix . )) | nindent 8 }}
Li Zic5290dc2018-08-06 09:26:27 +0000104 - name: {{ include "common.fullname" . }}-logs
105 emptyDir: {}
BorislavG0433c912018-03-21 18:35:30 +0200106 - name: localtime
107 hostPath:
108 path: /etc/localtime
BorislavG0433c912018-03-21 18:35:30 +0200109 imagePullSecrets:
110 - name: "{{ include "common.namespace" . }}-docker-registry-key"