[DMAAP] DMaaP ServiceMesh compatibility
[oom.git] / kubernetes / policy / components / policy-gui / templates / deployment.yaml
1 {{/*
2 #  ============LICENSE_START=======================================================
3 #   Copyright (C) 2021 Nordix Foundation.
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 #  SPDX-License-Identifier: Apache-2.0
18 #  ============LICENSE_END=========================================================
19 */}}
20
21 apiVersion: apps/v1
22 kind: Deployment
23 metadata:
24   name: {{ include "common.fullname" . }}
25   namespace: {{ include "common.namespace" . }}
26   labels:
27     app: {{ include "common.name" . }}
28     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
29     release: {{ include "common.release" . }}
30     heritage: {{ .Release.Service }}
31 spec:
32   replicas: {{ .Values.replicaCount }}
33   selector:
34     matchLabels:
35       app: {{ include "common.name" . }}
36   template:
37     metadata:
38       labels:
39         app: {{ include "common.name" . }}
40         release: {{ include "common.release" . }}
41     spec:
42       initContainers:
43       - command:
44         - /app/ready.py
45         args:
46         - --container-name
47         - policy-clamp-be
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54         image: {{ include "repositoryGenerator.image.readiness" . }}
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: {{ include "common.name" . }}-readiness
57 {{ include "common.certInitializer.initContainer" . | nindent 6 }}
58       containers:
59         # side car containers
60         {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.sidecar" . | nindent 8 }}{{ end }}
61         # main container
62         - name: {{ include "common.name" . }}
63           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
64           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65           ports:
66           - containerPort: {{ .Values.service.internalPort }}
67           # disable liveness probe when breakpoints set in debugger
68           # so K8s doesn't restart unresponsive container
69           {{- if eq .Values.liveness.enabled true }}
70           livenessProbe:
71             tcpSocket:
72               port: {{ .Values.service.internalPort }}
73             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
74             periodSeconds: {{ .Values.liveness.periodSeconds }}
75           {{ end -}}
76           readinessProbe:
77             tcpSocket:
78               port: {{ .Values.service.internalPort }}
79             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.readiness.periodSeconds }}
81           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
82           - name: logs
83             mountPath: {{ .Values.log.path }}
84           - mountPath: /etc/nginx/conf.d/default.conf
85             name: {{ include "common.fullname" . }}-config
86             subPath: default.conf
87           resources:
88 {{ include "common.resources" . | indent 12 }}
89         {{- if .Values.nodeSelector }}
90         nodeSelector:
91 {{ toYaml .Values.nodeSelector | indent 10 }}
92         {{- end -}}
93         {{- if .Values.affinity }}
94         affinity:
95 {{ toYaml .Values.affinity | indent 10 }}
96         {{- end }}
97       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
98       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
99         - name: {{ include "common.fullname" . }}-config
100           configMap:
101             name: {{ include "common.fullname" . }}
102             items:
103             - key: default.conf
104               path: default.conf
105         - name:  logs
106           emptyDir: {}
107         {{ if .Values.global.centralizedLoggingEnabled }}{{ include "common.log.volumes" . | nindent 8 }}{{ end }}
108       imagePullSecrets:
109       - name: "{{ include "common.namespace" . }}-docker-registry-key"