82d3d53ef0d1170c8641a15d192a89d6f574a54f
[oom.git] / kubernetes / msb / components / msb-eag / templates / deployment.yaml
1 {{/*
2 # Copyright © 2018 Amdocs, Bell Canada , ZTE
3 # Copyright © 2021 Orange
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 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       - command:
28         - /app/ready.py
29         args:
30         - --service-name
31         - msb-discovery
32         env:
33         - name: NAMESPACE
34           valueFrom:
35             fieldRef:
36               apiVersion: v1
37               fieldPath: metadata.namespace
38         image: {{ include "repositoryGenerator.image.readiness" . }}
39         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
40         name: {{ include "common.name" . }}-readiness
41         resources:
42           limits:
43             cpu: "100m"
44             memory: "500Mi"
45           requests:
46             cpu: "3m"
47             memory: "20Mi"
48       containers:
49         - name: {{ include "common.name" . }}
50           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           ports: {{- include "common.containerPorts" . | indent 10 }}
53           # disable liveness probe when breakpoints set in debugger
54           # so K8s doesn't restart unresponsive container
55           {{- if eq .Values.liveness.enabled true }}
56           livenessProbe:
57             tcpSocket:
58               port: {{ .Values.service.internalPort }}
59             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
60             periodSeconds: {{ .Values.liveness.periodSeconds }}
61           {{ end -}}
62           readinessProbe:
63             tcpSocket:
64               port: {{ .Values.service.internalPort }}
65             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
66             periodSeconds: {{ .Values.readiness.periodSeconds }}
67           env:
68           - name: CONSUL_IP
69             value: msb-consul.{{ include "common.namespace" . }}
70           - name: SDCLIENT_IP
71             value: msb-discovery.{{ include "common.namespace" . }}
72           - name: ROUTE_LABELS
73             value: {{ .Values.config.routeLabels }}
74           volumeMounts:
75           - mountPath: /etc/localtime
76             name: localtime
77             readOnly: true
78           - mountPath: /usr/local/apiroute-works/logs
79             name: {{ include "common.fullname" . }}-logs
80           resources: {{ include "common.resources" . | nindent 12 }}
81         {{- if .Values.nodeSelector }}
82         nodeSelector:
83 {{ toYaml .Values.nodeSelector | indent 10 }}
84         {{- end -}}
85         {{- if .Values.affinity }}
86         affinity:
87 {{ toYaml .Values.affinity | indent 10 }}
88         {{- end }}
89         # side car containers
90         {{ include "common.log.sidecar" . | nindent 8 }}
91       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
92       volumes:
93         - name: {{ include "common.fullname" . }}-log-conf
94           configMap:
95             name: {{ include "common.fullname" . }}-log
96         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix . )) | nindent 8 }}
97         - name:  {{ include "common.fullname" . }}-logs
98           emptyDir: {}
99         - name: localtime
100           hostPath:
101             path: /etc/localtime
102       {{- include "common.imagePullSecrets" . | nindent 6 }}