Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / policy / components / policy-drools-pdp / templates / statefulset.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018-2020, 2022 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
18 apiVersion: apps/v1
19 kind: StatefulSet
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   serviceName: {{ include "common.servicename" . }}
30   replicas: {{ .Values.replicaCount }}
31   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40       initContainers:
41       - command:
42         - /app/ready.py
43         args:
44         - --job-name
45         - {{ include "common.release" . }}-policy-galera-config
46         env:
47         - name: NAMESPACE
48           valueFrom:
49             fieldRef:
50               apiVersion: v1
51               fieldPath: metadata.namespace
52         image: {{ include "repositoryGenerator.image.readiness" . }}
53         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54         name: {{ include "common.name" . }}-db-readiness
55 {{- if not .Values.nexus.offline }}
56       - command:
57         - /app/ready.py
58         args:
59         - --container-name
60         - {{ .Values.nexus.name }}
61         env:
62         - name: NAMESPACE
63           valueFrom:
64             fieldRef:
65               apiVersion: v1
66               fieldPath: metadata.namespace
67         image: {{ include "repositoryGenerator.image.readiness" . }}
68         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69         name: {{ include "common.name" . }}-readiness
70 {{- end }}
71 {{ include "common.certInitializer.initContainer" . | indent 6 }}
72       containers:
73         - name: {{ include "common.name" . }}
74           image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
75           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76           command: ["sh","-c"]
77           args: ["if [ -f {{ .Values.certInitializer.credsPath }}/.ci ]; then \
78                   source {{ .Values.certInitializer.credsPath }}/.ci; fi;\
79                   cp {{ .Values.certInitializer.credsPath }}/org.onap.policy.p12 ${POLICY_HOME}/etc/ssl/policy-keystore;\
80                   /opt/app/policy/bin/pdpd-cl-entrypoint.sh boot"]
81           ports:
82           - containerPort: {{ .Values.service.externalPort }}
83           - containerPort: {{ .Values.service.externalPort2 }}
84           {{- if eq .Values.liveness.enabled true }}
85           livenessProbe:
86             httpGet:
87               path: /healthcheck/controllers
88               port: 6968
89             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90             periodSeconds: {{ .Values.liveness.periodSeconds }}
91             timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
92           {{- end }}
93           readinessProbe:
94             tcpSocket:
95               port: {{ .Values.service.externalPort }}
96             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
97             periodSeconds: {{ .Values.readiness.periodSeconds }}
98           env:
99           - name: REPLICAS
100             value: "{{ .Values.replicaCount }}"
101           - name: SQL_USER
102             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
103           - name: SQL_PASSWORD
104             {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
105           volumeMounts:
106 {{ include "common.certInitializer.volumeMount" . | indent 10 }}
107           - mountPath: /etc/localtime
108             name: localtime
109             readOnly: true
110           {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
111           - mountPath: /tmp/policy-install/config/{{ base $path }}
112             name: drools-secret
113             subPath: {{ base $path }}
114           {{- end }}
115           {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
116           - mountPath: /tmp/policy-install/config/{{ base $path }}
117             name: drools-config
118             subPath: {{ base $path }}
119           {{- end }}
120           resources:
121 {{ include "common.resources" . }}
122         {{- if .Values.nodeSelector }}
123         nodeSelector:
124 {{ toYaml .Values.nodeSelector | indent 10 }}
125         {{- end -}}
126         {{- if .Values.affinity }}
127         affinity:
128 {{ toYaml .Values.affinity | indent 10 }}
129         {{- end }}
130       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
131       volumes:
132 {{ include "common.certInitializer.volumes" . | indent 8 }}
133         - name: localtime
134           hostPath:
135             path: /etc/localtime
136         - name: drools-config
137           configMap:
138             name: {{ include "common.fullname" . }}-configmap
139             items:
140             {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
141             - key: {{ base $path }}
142               path: {{ base $path }}
143               mode: 0755
144             {{- end }}
145         - name: drools-secret
146           secret:
147             secretName: {{ include "common.fullname" . }}-secret
148             items:
149             {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
150             - key: {{ base $path }}
151               path: {{ base $path }}
152               mode: 0644
153             {{- end }}
154       imagePullSecrets:
155       - name: "{{ include "common.namespace" . }}-docker-registry-key"