[CPS] Parameterize topics in application
[oom.git] / kubernetes / policy / components / policy-apex-pdp / templates / statefulset.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: StatefulSet
26 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
27 spec:
28   selector: {{- include "common.selectors" . | nindent 4 }}
29   serviceName: {{ include "common.servicename" . }}
30   replicas: {{ .Values.replicaCount }}
31   template:
32     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
33     spec:
34       initContainers:
35       - command:
36         - sh
37         args:
38         - -c
39         - "cd /config-input && for PFILE in `ls -1`; 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 {{- if .Values.config.useStrimziKafka }}
46         - name: JAASLOGIN
47           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "policy-kafka-user" "key" "sasl.jaas.config") | indent 10 }}
48 {{- end }}
49         volumeMounts:
50         - mountPath: /config-input
51           name: apexconfig-input
52         - mountPath: /config
53           name: apexconfig
54         image: {{ include "repositoryGenerator.image.envsubst" . }}
55         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
56         name: {{ include "common.name" . }}-update-config
57       containers:
58         - name: {{ include "common.name" . }}
59           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
60           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61           command: ["sh","-c"]
62           args: ["/opt/app/policy/apex-pdp/bin/apexOnapPf.sh -c /home/apexuser/config/OnapPfConfig.json"]
63           ports: {{ include "common.containerPorts" . | nindent 12  }}
64           {{- if eq .Values.liveness.enabled true }}
65           livenessProbe:
66             tcpSocket:
67               port: {{ .Values.service.internalPort }}
68             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
69             periodSeconds: {{ .Values.liveness.periodSeconds }}
70           {{- end }}
71           readinessProbe:
72             tcpSocket:
73               port: {{ .Values.service.internalPort }}
74             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
75             periodSeconds: {{ .Values.readiness.periodSeconds }}
76           env:
77           - name: REPLICAS
78             value: "{{ .Values.replicaCount }}"
79           volumeMounts:
80           - mountPath: /etc/localtime
81             name: localtime
82             readOnly: true
83           - mountPath: /var/log/onap
84             name: policy-logs
85           - mountPath: /home/apexuser/config
86             name: apexconfig
87           resources: {{ include "common.resources" . | nindent 12 }}
88         {{- if .Values.nodeSelector }}
89         nodeSelector:
90 {{ toYaml .Values.nodeSelector | indent 10 }}
91         {{- end -}}
92         {{- if .Values.affinity }}
93         affinity:
94 {{ toYaml .Values.affinity | indent 10 }}
95         {{- end }}
96       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
97       volumes:
98         - name: localtime
99           hostPath:
100             path: /etc/localtime
101         - name: policy-logs
102           emptyDir: {}
103         - name: apexconfig-input
104           configMap:
105             name: {{ include "common.fullname" . }}-configmap
106             defaultMode: 0755
107         - name: apexconfig
108           emptyDir:
109             medium: Memory
110       imagePullSecrets:
111       - name: "{{ include "common.namespace" . }}-docker-registry-key"