Merge "[AAI] Add model-loader tracing config"
[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 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       initContainers:
34       - command: ["/bin/sh", "-cx"]
35         args:
36           - JAASLOGIN=`echo $JAASLOGIN | tr -d '"'`;
37             cd /config-input && for PFILE in `ls -1`;
38             do envsubst <${PFILE} >/config/${PFILE}; done
39         env:
40         - name: RESTSERVER_USER
41           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
42         - name: RESTSERVER_PASSWORD
43           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
44         - name: JAASLOGIN
45           valueFrom:
46             secretKeyRef:
47               name: {{ include "common.name" . }}-ku
48               key: sasl.jaas.config
49         - name: KAFKA_URL
50           value: {{ include "common.release" . }}-{{ .Values.global.kafkaBootstrap }}
51         - name: SASL
52           value: {{ .Values.kafkaUser.authenticationType | upper }}
53         - name: GROUP_ID
54           value: {{ .Values.config.kafka.consumer.groupId }}
55         - name: PAP_TOPIC
56           value: {{ .Values.config.app.listener.policyPdpPapTopic }}
57         volumeMounts:
58         - mountPath: /config-input
59           name: apexconfig-input
60         - mountPath: /config
61           name: apexconfig
62         image: {{ include "repositoryGenerator.image.envsubst" . }}
63         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
64         name: {{ include "common.name" . }}-update-config
65       containers:
66         - name: {{ include "common.name" . }}
67           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
68           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69           command: [ "/bin/sh", "-cx" ]
70           args:
71             - id apexuser;
72               cat /home/apexuser/config/OnapPfConfig.json;
73               /opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /home/apexuser/config/OnapPfConfig.json
74           ports: {{ include "common.containerPorts" . | nindent 12  }}
75           {{- if eq .Values.liveness.enabled true }}
76           livenessProbe:
77             tcpSocket:
78               port: {{ .Values.service.internalPort }}
79             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.liveness.periodSeconds }}
81           {{- end }}
82           readinessProbe:
83             tcpSocket:
84               port: {{ .Values.service.internalPort }}
85             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
86             periodSeconds: {{ .Values.readiness.periodSeconds }}
87           env:
88           - name: REPLICAS
89             value: "{{ .Values.replicaCount }}"
90           volumeMounts:
91           - mountPath: /var/log/onap
92             name: policy-logs
93           - mountPath: /home/apexuser/config
94             name: apexconfig
95           resources: {{ include "common.resources" . | nindent 12 }}
96       {{- if .Values.nodeSelector }}
97       nodeSelector:
98 {{ toYaml .Values.nodeSelector | indent 10 }}
99         {{- end -}}
100       {{- if .Values.affinity }}
101       affinity:
102 {{ toYaml .Values.affinity | indent 10 }}
103         {{- end }}
104       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
105       volumes:
106         - name: policy-logs
107           emptyDir: {}
108         - name: apexconfig-input
109           configMap:
110             name: {{ include "common.fullname" . }}-configmap
111             defaultMode: 0755
112         - name: apexconfig
113           emptyDir:
114             medium: Memory
115       {{- include "common.imagePullSecrets" . | nindent 6 }}