[SO] 16.0.4 release
[oom.git] / kubernetes / policy / components / policy-apex-pdp / templates / deployment.yaml
1 {{/*
2 #  ============LICENSE_START=======================================================
3 #   Copyright (C) 2018 Ericsson. All rights reserved.
4 #   Modifications Copyright (C) 2020 AT&T Intellectual Property.
5 #   Modifications Copyright © 2022 Nordix Foundation
6 #   Modification (C) 2023-2024 Deutsche Telekom. All rights reserved.
7 #  ================================================================================
8 #  Licensed under the Apache License, Version 2.0 (the "License");
9 #  you may not use this file except in compliance with the License.
10 #  You may obtain a copy of the License at
11 #
12 #       http://www.apache.org/licenses/LICENSE-2.0
13 #
14 #  Unless required by applicable law or agreed to in writing, software
15 #  distributed under the License is distributed on an "AS IS" BASIS,
16 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 #  See the License for the specific language governing permissions and
18 #  limitations under the License.
19 #
20 #  SPDX-License-Identifier: Apache-2.0
21 #  ============LICENSE_END=========================================================
22 */}}
23
24 apiVersion: apps/v1
25 kind: Deployment
26 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
27 spec:
28   selector: {{- include "common.selectors" . | nindent 4 }}
29   replicas: {{ .Values.replicaCount }}
30   template:
31     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
32     spec:
33       {{ include "common.podSecurityContext" . | indent 6 | trim }}
34       initContainers:
35       - command: ["/bin/sh", "-cx"]
36         args:
37           - JAASLOGIN=`echo $JAASLOGIN | tr -d '"'`;
38             cd /config-input && for PFILE in `ls -1`;
39             do envsubst <${PFILE} >/config/${PFILE}; done
40         env:
41         - name: RESTSERVER_USER
42           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
43         - name: RESTSERVER_PASSWORD
44           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
45         - name: JAASLOGIN
46           valueFrom:
47             secretKeyRef:
48               name: {{ include "common.name" . }}-ku
49               key: sasl.jaas.config
50         - name: KAFKA_URL
51           value: {{ include "common.release" . }}-{{ .Values.global.kafkaBootstrap }}
52         - name: SASL
53           value: {{ .Values.kafkaUser.authenticationType | upper }}
54         - name: GROUP_ID
55           value: {{ .Values.config.kafka.consumer.groupId }}
56         - name: PAP_TOPIC
57           value: {{ .Values.config.app.listener.policyPdpPapTopic }}
58         volumeMounts:
59         - mountPath: /config-input
60           name: apexconfig-input
61         - mountPath: /config
62           name: apexconfig
63         image: {{ include "repositoryGenerator.image.envsubst" . }}
64         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
65         name: {{ include "common.name" . }}-update-config
66         {{ include "common.containerSecurityContext" . | indent 8 | trim }}
67       containers:
68         - name: {{ include "common.name" . }}
69           {{ include "common.containerSecurityContext" . | indent 10 | trim }}
70           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
71           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
72           command: [ "/bin/sh", "-cx" ]
73           args:
74             - id apexuser;
75               cat /home/apexuser/config/OnapPfConfig.json;
76               /opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /home/apexuser/config/OnapPfConfig.json
77           ports: {{ include "common.containerPorts" . | nindent 12  }}
78           {{- if eq .Values.liveness.enabled true }}
79           livenessProbe:
80             tcpSocket:
81               port: {{ .Values.service.internalPort }}
82             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
83             periodSeconds: {{ .Values.liveness.periodSeconds }}
84           {{- end }}
85           readinessProbe:
86             tcpSocket:
87               port: {{ .Values.service.internalPort }}
88             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
89             periodSeconds: {{ .Values.readiness.periodSeconds }}
90           env:
91           - name: REPLICAS
92             value: "{{ .Values.replicaCount }}"
93           volumeMounts:
94           - mountPath: /var/log/onap
95             name: policy-logs
96           - mountPath: /home/apexuser/config
97             name: apexconfig
98           resources: {{ include "common.resources" . | nindent 12 }}
99       {{- if .Values.nodeSelector }}
100       nodeSelector:
101 {{ toYaml .Values.nodeSelector | indent 10 }}
102         {{- end -}}
103       {{- if .Values.affinity }}
104       affinity:
105 {{ toYaml .Values.affinity | indent 10 }}
106         {{- end }}
107       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
108       volumes:
109         - name: policy-logs
110           emptyDir:
111             sizeLimit: {{ .Values.dirSizes.logDir.sizeLimit }}
112         - name: apexconfig-input
113           configMap:
114             name: {{ include "common.fullname" . }}-configmap
115             defaultMode: 0755
116         - name: apexconfig
117           emptyDir:
118             medium: Memory
119             sizeLimit: 64Mi
120       {{- include "common.imagePullSecrets" . | nindent 6 }}