[POLICY] tomcat security upgrade legacy components
[oom.git] / kubernetes / policy / charts / policy-apex-pdp / templates / statefulset.yaml
1 #  ============LICENSE_START=======================================================
2 #   Copyright (C) 2018 Ericsson. All rights reserved.
3 #   Modifications Copyright (C) 2020 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 apiVersion: apps/v1beta1
21 kind: StatefulSet
22 metadata:
23   name: {{ include "common.fullname" . }}
24   namespace: {{ include "common.namespace" . }}
25   labels:
26     app: {{ include "common.name" . }}
27     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28     release: {{ include "common.release" . }}
29     heritage: {{ .Release.Service }}
30 spec:
31   serviceName: {{ include "common.servicename" . }}
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         - sh
45         args:
46         - -c
47         - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
48         env:
49         - name: RESTSERVER_USER
50           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "login") | indent 10 }}
51         - name: RESTSERVER_PASSWORD
52           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "restserver-creds" "key" "password") | indent 10 }}
53         volumeMounts:
54         - mountPath: /config-input
55           name: apexconfig-input
56         - mountPath: /config
57           name: apexconfig
58         image: "{{ .Values.global.envsubstImage }}"
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         name: {{ include "common.name" . }}-update-config
61       containers:
62         - name: {{ include "common.name" . }}
63           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
64           command:
65           - /opt/app/policy/apex-pdp/bin/apexOnapPf.sh
66           - -c
67           - /home/apexuser/config/OnapPfConfig.json
68           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69           ports:
70           - containerPort: {{ .Values.service.externalPort }}
71           {{- if eq .Values.liveness.enabled true }}
72           livenessProbe:
73             tcpSocket:
74               port: {{ .Values.service.externalPort }}
75             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
76             periodSeconds: {{ .Values.liveness.periodSeconds }}
77           {{- end }}
78           readinessProbe:
79             tcpSocket:
80               port: {{ .Values.service.externalPort }}
81             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
82             periodSeconds: {{ .Values.readiness.periodSeconds }}
83           env:
84           - name: REPLICAS
85             value: "{{ .Values.replicaCount }}"
86           - name: KEYSTORE_PASSWORD
87             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-pass" "key" "password") | indent 12 }}
88           - name: TRUSTSTORE_PASSWORD
89             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-pass" "key" "password") | indent 12 }}
90           volumeMounts:
91           - mountPath: /etc/localtime
92             name: localtime
93             readOnly: true
94           - mountPath: /var/log/onap
95             name: policy-logs
96           - mountPath: /home/apexuser/config
97             name: apexconfig
98           resources:
99 {{ include "common.resources" . | indent 12 }}
100         {{- if .Values.nodeSelector }}
101         nodeSelector:
102 {{ toYaml .Values.nodeSelector | indent 10 }}
103         {{- end -}}
104         {{- if .Values.affinity }}
105         affinity:
106 {{ toYaml .Values.affinity | indent 10 }}
107         {{- end }}
108       volumes:
109         - name: localtime
110           hostPath:
111             path: /etc/localtime
112         - name: policy-logs
113           emptyDir: {}
114         - name: apexconfig-input
115           configMap:
116             name: {{ include "common.fullname" . }}-configmap
117             defaultMode: 0755
118         - name: apexconfig
119           emptyDir:
120             medium: Memory
121       imagePullSecrets:
122       - name: "{{ include "common.namespace" . }}-docker-registry-key"