blob: 7dee453771c2b3d592c7d1e2aa862c5120fdcbd2 [file] [log] [blame]
Jakub Latusekd71d26c2020-10-21 13:36:29 +02001{{/*
mayankg2703ced85142018-03-20 05:42:53 +00002# Copyright © 2017 Amdocs, Bell Canada
jhh0d1c0e82022-04-08 14:36:15 -05003# Modifications Copyright © 2018-2020, 2022 AT&T Intellectual Property
mayankg2703ced85142018-03-20 05:42:53 +00004#
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.
Jakub Latusekd71d26c2020-10-21 13:36:29 +020016*/}}
mayankg2703ced85142018-03-20 05:42:53 +000017
Grzegorz-Lis4fad3022020-07-31 10:18:21 +020018apiVersion: apps/v1
mayankg2703c7985462018-03-29 14:24:23 +000019kind: StatefulSet
mayankg2703ced85142018-03-20 05:42:53 +000020metadata:
21 name: {{ include "common.fullname" . }}
22 namespace: {{ include "common.namespace" . }}
23 labels:
24 app: {{ include "common.name" . }}
25 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010026 release: {{ include "common.release" . }}
mayankg2703ced85142018-03-20 05:42:53 +000027 heritage: {{ .Release.Service }}
28spec:
Mahendra Raghuwanshic1395ec2018-04-26 03:19:03 +000029 serviceName: {{ include "common.servicename" . }}
mayankg2703ced85142018-03-20 05:42:53 +000030 replicas: {{ .Values.replicaCount }}
mayankg2703c7985462018-03-29 14:24:23 +000031 selector:
32 matchLabels:
33 app: {{ include "common.name" . }}
mayankg2703ced85142018-03-20 05:42:53 +000034 template:
35 metadata:
36 labels:
37 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010038 release: {{ include "common.release" . }}
mayankg2703ced85142018-03-20 05:42:53 +000039 spec:
40 initContainers:
41 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020042 - /app/ready.py
jhhd4258672020-08-09 12:08:08 -050043 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
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010052 image: {{ include "repositoryGenerator.image.readiness" . }}
jhhd4258672020-08-09 12:08:08 -050053 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54 name: {{ include "common.name" . }}-db-readiness
55{{- if not .Values.nexus.offline }}
56 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020057 - /app/ready.py
mayankg2703ced85142018-03-20 05:42:53 +000058 args:
59 - --container-name
jhhd4258672020-08-09 12:08:08 -050060 - {{ .Values.nexus.name }}
mayankg2703ced85142018-03-20 05:42:53 +000061 env:
62 - name: NAMESPACE
63 valueFrom:
64 fieldRef:
65 apiVersion: v1
66 fieldPath: metadata.namespace
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010067 image: {{ include "repositoryGenerator.image.readiness" . }}
mayankg2703ced85142018-03-20 05:42:53 +000068 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
69 name: {{ include "common.name" . }}-readiness
jhhd4258672020-08-09 12:08:08 -050070{{- end }}
71{{ include "common.certInitializer.initContainer" . | indent 6 }}
mayankg2703ced85142018-03-20 05:42:53 +000072 containers:
73 - name: {{ include "common.name" . }}
Sylvain Desbureaux7c8c6862020-11-19 18:02:37 +010074 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
mayankg2703ced85142018-03-20 05:42:53 +000075 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
Taka Cho9658ce82020-12-10 14:34:18 -050076 command: ["sh","-c"]
jhhd4258672020-08-09 12:08:08 -050077 args: ["if [ -f {{ .Values.certInitializer.credsPath }}/.ci ]; then \
78 source {{ .Values.certInitializer.credsPath }}/.ci; fi;\
jhhbf8d8a92020-09-10 14:01:49 -050079 cp {{ .Values.certInitializer.credsPath }}/org.onap.policy.p12 ${POLICY_HOME}/etc/ssl/policy-keystore;\
jhhd4258672020-08-09 12:08:08 -050080 /opt/app/policy/bin/pdpd-cl-entrypoint.sh boot"]
mayankg2703ced85142018-03-20 05:42:53 +000081 ports:
82 - containerPort: {{ .Values.service.externalPort }}
83 - containerPort: {{ .Values.service.externalPort2 }}
mayankg2703ced85142018-03-20 05:42:53 +000084 {{- if eq .Values.liveness.enabled true }}
85 livenessProbe:
jhh0d1c0e82022-04-08 14:36:15 -050086 httpGet:
87 path: /healthcheck/controllers
88 port: 6968
mayankg2703ced85142018-03-20 05:42:53 +000089 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90 periodSeconds: {{ .Values.liveness.periodSeconds }}
jhh0d1c0e82022-04-08 14:36:15 -050091 timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
mayankg2703ced85142018-03-20 05:42:53 +000092 {{- 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 }}"
Krzysztof Opasiak68b1c922020-03-26 23:59:36 +0100101 - name: SQL_USER
Krzysztof Opasiak4372e832020-09-01 19:17:20 +0200102 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Krzysztof Opasiak68b1c922020-03-26 23:59:36 +0100103 - name: SQL_PASSWORD
Krzysztof Opasiak4372e832020-09-01 19:17:20 +0200104 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
mayankg2703ced85142018-03-20 05:42:53 +0000105 volumeMounts:
jhhd4258672020-08-09 12:08:08 -0500106{{ include "common.certInitializer.volumeMount" . | indent 10 }}
mayankg2703ced85142018-03-20 05:42:53 +0000107 - mountPath: /etc/localtime
108 name: localtime
109 readOnly: true
jhh01096592019-09-04 07:47:25 -0500110 {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
111 - mountPath: /tmp/policy-install/config/{{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000112 name: drools-secret
jhh01096592019-09-04 07:47:25 -0500113 subPath: {{ base $path }}
114 {{- end }}
115 {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
116 - mountPath: /tmp/policy-install/config/{{ base $path }}
Jorge Hernandez328eadb2018-05-15 07:52:21 -0500117 name: drools-config
jhh01096592019-09-04 07:47:25 -0500118 subPath: {{ base $path }}
119 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000120 resources:
jhhd4258672020-08-09 12:08:08 -0500121{{ include "common.resources" . }}
mayankg2703ced85142018-03-20 05:42:53 +0000122 {{- if .Values.nodeSelector }}
mayankg2703ced85142018-03-20 05:42:53 +0000123 nodeSelector:
124{{ toYaml .Values.nodeSelector | indent 10 }}
125 {{- end -}}
126 {{- if .Values.affinity }}
127 affinity:
128{{ toYaml .Values.affinity | indent 10 }}
129 {{- end }}
farida azmyc1178372021-04-11 12:55:33 +0200130 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
mayankg2703ced85142018-03-20 05:42:53 +0000131 volumes:
jhhd4258672020-08-09 12:08:08 -0500132{{ include "common.certInitializer.volumes" . | indent 8 }}
mayankg2703ced85142018-03-20 05:42:53 +0000133 - name: localtime
134 hostPath:
135 path: /etc/localtime
mayankg2703ced85142018-03-20 05:42:53 +0000136 - name: drools-config
137 configMap:
138 name: {{ include "common.fullname" . }}-configmap
139 items:
jhh01096592019-09-04 07:47:25 -0500140 {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
141 - key: {{ base $path }}
142 path: {{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000143 mode: 0755
jhh01096592019-09-04 07:47:25 -0500144 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000145 - name: drools-secret
146 secret:
147 secretName: {{ include "common.fullname" . }}-secret
148 items:
jhh01096592019-09-04 07:47:25 -0500149 {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
150 - key: {{ base $path }}
151 path: {{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000152 mode: 0644
jhh01096592019-09-04 07:47:25 -0500153 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000154 imagePullSecrets:
155 - name: "{{ include "common.namespace" . }}-docker-registry-key"