blob: 403f6988f94ea11cc901b1e7c0990b20e41a3be5 [file] [log] [blame]
Jakub Latusekd71d26c2020-10-21 13:36:29 +02001{{/*
jhhd4258672020-08-09 12:08:08 -05002# ============LICENSE_START=======================================================
3# Copyright (C) 2020 AT&T Intellectual Property.
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=========================================================
Jakub Latusekd71d26c2020-10-21 13:36:29 +020019*/}}
jhhd4258672020-08-09 12:08:08 -050020
Grzegorz-Lis4fad3022020-07-31 10:18:21 +020021apiVersion: apps/v1
Michael Mokryafae9972019-03-11 14:46:34 -050022kind: Deployment
Andreas Geisslerf10c5552023-03-21 18:09:46 +010023metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Michael Mokryafae9972019-03-11 14:46:34 -050024spec:
Andreas Geisslerf10c5552023-03-21 18:09:46 +010025 selector: {{- include "common.selectors" . | nindent 4 }}
Michael Mokryafae9972019-03-11 14:46:34 -050026 replicas: {{ .Values.replicaCount }}
27 template:
Andreas Geisslerf10c5552023-03-21 18:09:46 +010028 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
Michael Mokryafae9972019-03-11 14:46:34 -050029 spec:
Michael Mokry3b2647a2019-04-14 20:24:43 -050030 initContainers:
31 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020032 - /app/ready.py
Michael Mokry3b2647a2019-04-14 20:24:43 -050033 args:
jhhd4258672020-08-09 12:08:08 -050034 - --job-name
35 - {{ include "common.release" . }}-policy-galera-config
Michael Mokry3b2647a2019-04-14 20:24:43 -050036 env:
37 - name: NAMESPACE
38 valueFrom:
39 fieldRef:
40 apiVersion: v1
41 fieldPath: metadata.namespace
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010042 image: {{ include "repositoryGenerator.image.readiness" . }}
Michael Mokry3b2647a2019-04-14 20:24:43 -050043 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
44 name: {{ include "common.name" . }}-readiness
Andreas Geissler47537432024-02-27 08:55:23 +010045 resources:
46 limits:
47 cpu: "100m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010048 memory: "500Mi"
Andreas Geissler47537432024-02-27 08:55:23 +010049 requests:
50 cpu: "3m"
Andreas Geissler8cbb3d92024-03-12 16:44:56 +010051 memory: "20Mi"
Dominik Mizync88bcc92020-04-14 18:20:20 +020052 - command:
53 - sh
54 args:
55 - -c
rameshiyer27bc8a6a42024-03-11 17:18:11 +000056 - JAASLOGIN=`echo $JAASLOGIN | tr -d '"'`; cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done
Dominik Mizync88bcc92020-04-14 18:20:20 +020057 env:
58 - name: RESTSERVER_USER
59 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
60 - name: RESTSERVER_PASSWORD
61 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
62 - name: API_USER
63 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-creds" "key" "login") | indent 10 }}
64 - name: API_PASSWORD
65 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "api-creds" "key" "password") | indent 10 }}
jhhed6839f2020-05-08 12:28:27 -050066 - name: SQL_USER
67 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
68 - name: SQL_PASSWORD
69 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
rameshiyer27bc8a6a42024-03-11 17:18:11 +000070 - name: JAASLOGIN
71 valueFrom:
72 secretKeyRef:
73 name: {{ include "common.name" . }}-ku
74 key: sasl.jaas.config
75 - name: KAFKA_URL
76 value: {{ include "common.release" . }}-{{ .Values.global.kafkaBootstrap }}
77 - name: SASL
78 value: {{ .Values.kafkaUser.authenticationType | upper }}
79 - name: GROUP_ID
80 value: {{ .Values.config.kafka.consumer.groupId }}
81 - name: PAP_TOPIC
82 value: {{ .Values.config.app.listener.policyPdpPapTopic }}
Dominik Mizync88bcc92020-04-14 18:20:20 +020083 volumeMounts:
84 - mountPath: /config-input
85 name: pdpxconfig
86 - mountPath: /config
87 name: pdpxconfig-processed
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010088 image: {{ include "repositoryGenerator.image.envsubst" . }}
Dominik Mizync88bcc92020-04-14 18:20:20 +020089 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
90 name: {{ include "common.name" . }}-update-config
Michael Mokryafae9972019-03-11 14:46:34 -050091 containers:
92 - name: {{ include "common.name" . }}
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010093 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Michael Mokryafae9972019-03-11 14:46:34 -050094 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95 command: ["/opt/app/policy/pdpx/bin/policy-pdpx.sh"]
jhhbf7fb4d2019-08-07 16:54:41 -050096 args: ["/opt/app/policy/pdpx/etc/mounted/config.json"]
Andreas Geisslerb3f16b92023-04-03 12:19:48 +020097 ports: {{ include "common.containerPorts" . | nindent 12 }}
Michael Mokryafae9972019-03-11 14:46:34 -050098 # disable liveness probe when breakpoints set in debugger
99 # so K8s doesn't restart unresponsive container
100 {{- if eq .Values.liveness.enabled true }}
101 livenessProbe:
102 tcpSocket:
103 port: {{ .Values.service.internalPort }}
104 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
105 periodSeconds: {{ .Values.liveness.periodSeconds }}
106 {{ end -}}
107 readinessProbe:
108 tcpSocket:
109 port: {{ .Values.service.internalPort }}
110 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
111 periodSeconds: {{ .Values.readiness.periodSeconds }}
112 volumeMounts:
113 - mountPath: /etc/localtime
114 name: localtime
115 readOnly: true
116 - mountPath: /opt/app/policy/pdpx/etc/mounted
Dominik Mizync88bcc92020-04-14 18:20:20 +0200117 name: pdpxconfig-processed
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100118 resources: {{ include "common.resources" . | nindent 12 }}
Michael Mokryafae9972019-03-11 14:46:34 -0500119 {{- if .Values.nodeSelector }}
120 nodeSelector:
121{{ toYaml .Values.nodeSelector | indent 10 }}
122 {{- end -}}
123 {{- if .Values.affinity }}
124 affinity:
125{{ toYaml .Values.affinity | indent 10 }}
126 {{- end }}
farida azmyc1178372021-04-11 12:55:33 +0200127 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Michael Mokryafae9972019-03-11 14:46:34 -0500128 volumes:
129 - name: localtime
130 hostPath:
131 path: /etc/localtime
132 - name: pdpxconfig
133 configMap:
134 name: {{ include "common.fullname" . }}-configmap
135 defaultMode: 0755
Dominik Mizync88bcc92020-04-14 18:20:20 +0200136 - name: pdpxconfig-processed
137 emptyDir:
138 medium: Memory
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +0100139 {{- include "common.imagePullSecrets" . | nindent 6 }}