blob: 5828be48d7d0160bd2d7308fccb0500d57e1fb3e [file] [log] [blame]
mayankg2703ced85142018-03-20 05:42:53 +00001# Copyright © 2017 Amdocs, Bell Canada
jhhd4258672020-08-09 12:08:08 -05002# Modifications Copyright © 2018-2020 AT&T Intellectual Property
mayankg2703ced85142018-03-20 05:42:53 +00003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
Grzegorz-Lis4fad3022020-07-31 10:18:21 +020016apiVersion: apps/v1
mayankg2703c7985462018-03-29 14:24:23 +000017kind: StatefulSet
mayankg2703ced85142018-03-20 05:42:53 +000018metadata:
19 name: {{ include "common.fullname" . }}
20 namespace: {{ include "common.namespace" . }}
21 labels:
22 app: {{ include "common.name" . }}
23 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010024 release: {{ include "common.release" . }}
mayankg2703ced85142018-03-20 05:42:53 +000025 heritage: {{ .Release.Service }}
26spec:
Mahendra Raghuwanshic1395ec2018-04-26 03:19:03 +000027 serviceName: {{ include "common.servicename" . }}
mayankg2703ced85142018-03-20 05:42:53 +000028 replicas: {{ .Values.replicaCount }}
mayankg2703c7985462018-03-29 14:24:23 +000029 selector:
30 matchLabels:
31 app: {{ include "common.name" . }}
mayankg2703ced85142018-03-20 05:42:53 +000032 template:
33 metadata:
34 labels:
35 app: {{ include "common.name" . }}
Krzysztof Opasiak137d7cc2020-01-24 23:49:11 +010036 release: {{ include "common.release" . }}
mayankg2703ced85142018-03-20 05:42:53 +000037 spec:
38 initContainers:
39 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020040 - /app/ready.py
jhhd4258672020-08-09 12:08:08 -050041 args:
42 - --job-name
43 - {{ include "common.release" . }}-policy-galera-config
44 env:
45 - name: NAMESPACE
46 valueFrom:
47 fieldRef:
48 apiVersion: v1
49 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020050 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
jhhd4258672020-08-09 12:08:08 -050051 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52 name: {{ include "common.name" . }}-db-readiness
53{{- if not .Values.nexus.offline }}
54 - command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020055 - /app/ready.py
mayankg2703ced85142018-03-20 05:42:53 +000056 args:
57 - --container-name
jhhd4258672020-08-09 12:08:08 -050058 - {{ .Values.nexus.name }}
mayankg2703ced85142018-03-20 05:42:53 +000059 env:
60 - name: NAMESPACE
61 valueFrom:
62 fieldRef:
63 apiVersion: v1
64 fieldPath: metadata.namespace
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020065 image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
mayankg2703ced85142018-03-20 05:42:53 +000066 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67 name: {{ include "common.name" . }}-readiness
jhhd4258672020-08-09 12:08:08 -050068{{- end }}
69{{ include "common.certInitializer.initContainer" . | indent 6 }}
mayankg2703ced85142018-03-20 05:42:53 +000070 containers:
71 - name: {{ include "common.name" . }}
BorislavGdf11cd52018-05-06 12:55:20 +000072 image: "{{ include "common.repository" . }}/{{ .Values.image }}"
mayankg2703ced85142018-03-20 05:42:53 +000073 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
jhhd4258672020-08-09 12:08:08 -050074 command: ["bash","-c"]
75 args: ["if [ -f {{ .Values.certInitializer.credsPath }}/.ci ]; then \
76 source {{ .Values.certInitializer.credsPath }}/.ci; fi;\
77 /opt/app/policy/bin/pdpd-cl-entrypoint.sh boot"]
mayankg2703ced85142018-03-20 05:42:53 +000078 ports:
79 - containerPort: {{ .Values.service.externalPort }}
80 - containerPort: {{ .Values.service.externalPort2 }}
mayankg2703ced85142018-03-20 05:42:53 +000081 {{- if eq .Values.liveness.enabled true }}
82 livenessProbe:
83 tcpSocket:
84 port: {{ .Values.service.externalPort }}
85 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
86 periodSeconds: {{ .Values.liveness.periodSeconds }}
87 {{- end }}
88 readinessProbe:
89 tcpSocket:
90 port: {{ .Values.service.externalPort }}
91 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
92 periodSeconds: {{ .Values.readiness.periodSeconds }}
93 env:
94 - name: REPLICAS
95 value: "{{ .Values.replicaCount }}"
Krzysztof Opasiak68b1c922020-03-26 23:59:36 +010096 - name: SQL_USER
Krzysztof Opasiak4372e832020-09-01 19:17:20 +020097 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 12 }}
Krzysztof Opasiak68b1c922020-03-26 23:59:36 +010098 - name: SQL_PASSWORD
Krzysztof Opasiak4372e832020-09-01 19:17:20 +020099 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 12 }}
mayankg2703ced85142018-03-20 05:42:53 +0000100 volumeMounts:
jhhd4258672020-08-09 12:08:08 -0500101{{ include "common.certInitializer.volumeMount" . | indent 10 }}
mayankg2703ced85142018-03-20 05:42:53 +0000102 - mountPath: /etc/localtime
103 name: localtime
104 readOnly: true
jhh01096592019-09-04 07:47:25 -0500105 {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
106 - mountPath: /tmp/policy-install/config/{{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000107 name: drools-secret
jhh01096592019-09-04 07:47:25 -0500108 subPath: {{ base $path }}
109 {{- end }}
110 {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
111 - mountPath: /tmp/policy-install/config/{{ base $path }}
Jorge Hernandez328eadb2018-05-15 07:52:21 -0500112 name: drools-config
jhh01096592019-09-04 07:47:25 -0500113 subPath: {{ base $path }}
114 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000115 resources:
jhhd4258672020-08-09 12:08:08 -0500116{{ include "common.resources" . }}
mayankg2703ced85142018-03-20 05:42:53 +0000117 {{- if .Values.nodeSelector }}
mayankg2703ced85142018-03-20 05:42:53 +0000118 nodeSelector:
119{{ toYaml .Values.nodeSelector | indent 10 }}
120 {{- end -}}
121 {{- if .Values.affinity }}
122 affinity:
123{{ toYaml .Values.affinity | indent 10 }}
124 {{- end }}
125 volumes:
jhhd4258672020-08-09 12:08:08 -0500126{{ include "common.certInitializer.volumes" . | indent 8 }}
mayankg2703ced85142018-03-20 05:42:53 +0000127 - name: localtime
128 hostPath:
129 path: /etc/localtime
mayankg2703ced85142018-03-20 05:42:53 +0000130 - name: drools-config
131 configMap:
132 name: {{ include "common.fullname" . }}-configmap
133 items:
jhh01096592019-09-04 07:47:25 -0500134 {{- range $path, $bytes := .Files.Glob "resources/configmaps/*" }}
135 - key: {{ base $path }}
136 path: {{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000137 mode: 0755
jhh01096592019-09-04 07:47:25 -0500138 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000139 - name: drools-secret
140 secret:
141 secretName: {{ include "common.fullname" . }}-secret
142 items:
jhh01096592019-09-04 07:47:25 -0500143 {{- range $path, $bytes := .Files.Glob "resources/secrets/*" }}
144 - key: {{ base $path }}
145 path: {{ base $path }}
mayankg2703ced85142018-03-20 05:42:53 +0000146 mode: 0644
jhh01096592019-09-04 07:47:25 -0500147 {{- end }}
mayankg2703ced85142018-03-20 05:42:53 +0000148 imagePullSecrets:
149 - name: "{{ include "common.namespace" . }}-docker-registry-key"