blob: 4458744a558f7fe8031d3476a4c05eaea3413789 [file] [log] [blame]
Lathish818ee5d2020-08-26 13:45:03 +01001{{/*
2################################################################################
3# Copyright (c) 2020 Nordix Foundation. #
Konrad Bańka52c38b92020-10-28 16:49:19 +01004# Copyright © 2020 Samsung Electronics, Modifications #
Lathish818ee5d2020-08-26 13:45:03 +01005# #
6# Licensed under the Apache License, Version 2.0 (the "License"); #
7# you may not use this file except in compliance with the License. #
8# You may obtain a copy of the License at #
9# #
10# http://www.apache.org/licenses/LICENSE-2.0 #
11# #
12# Unless required by applicable law or agreed to in writing, software #
13# distributed under the License is distributed on an "AS IS" BASIS, #
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15# See the License for the specific language governing permissions and #
16# limitations under the License. #
17################################################################################
18*/}}
19
PatrikBuhr746ff372021-04-30 15:12:51 +020020kind: StatefulSet
Lathish818ee5d2020-08-26 13:45:03 +010021apiVersion: apps/v1
PatrikBuhr746ff372021-04-30 15:12:51 +020022metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
Lathish818ee5d2020-08-26 13:45:03 +010023spec:
PatrikBuhr746ff372021-04-30 15:12:51 +020024 serviceName: {{ include "common.servicename" . }}
Lathish818ee5d2020-08-26 13:45:03 +010025 replicas: {{ index .Values.replicaCount }}
26 selector: {{- include "common.selectors" . | nindent 4 }}
27 template:
28 metadata:
29 labels: {{- include "common.labels" . | nindent 8 }}
30 spec:
Andreas Geisslerbd0d31a2024-03-20 09:51:32 +010031 {{- include "common.imagePullSecrets" . | nindent 6 }}
Andreas Geissler353a8c92023-03-15 16:15:11 +010032 initContainers:
Konrad Bańka52c38b92020-10-28 16:49:19 +010033 - name: {{ include "common.name" . }}-bootstrap-config
Sylvain Desbureauxd4a6afd2020-11-21 22:01:15 +010034 image: {{ include "repositoryGenerator.image.envsubst" . }}
Lathish818ee5d2020-08-26 13:45:03 +010035 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
36 command:
37 - sh
38 args:
39 - -c
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +010040 - |
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +010041 cd /config-input
42 for PFILE in `ls -1`
43 do
44 envsubst <${PFILE} >/config/${PFILE}
45 chmod o+w /config/${PFILE}
46 done
47 cat /config/application.yaml
Lathish818ee5d2020-08-26 13:45:03 +010048 env:
49 - name: A1CONTROLLER_USER
50 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "login") | indent 10 }}
51 - name: A1CONTROLLER_PASSWORD
52 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "password") | indent 10 }}
Andreas Geissler353a8c92023-03-15 16:15:11 +010053 volumeMounts:
Lathish818ee5d2020-08-26 13:45:03 +010054 - mountPath: /config-input
55 name: {{ include "common.fullname" . }}-policy-conf-input
56 - mountPath: /config
57 name: config
58 containers:
Konrad Bańka52c38b92020-10-28 16:49:19 +010059 - name: {{ include "common.name" . }}-update-config
Andreas Geissler3f5a6142021-11-24 14:01:31 +000060 image: {{ include "repositoryGenerator.image.envsubst" . }}
Konrad Bańka52c38b92020-10-28 16:49:19 +010061 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62 securityContext:
63 runAsGroup: {{ .Values.groupID }}
64 runAsUser: {{ .Values.userID }}
65 runAsNonRoot: true
66 command:
67 - sh
68 args:
69 - /tmp/scripts/daemon.sh
70 env:
71 - name: A1CONTROLLER_USER
72 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "login") | indent 10 }}
73 - name: A1CONTROLLER_PASSWORD
74 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "password") | indent 10 }}
75 volumeMounts:
76 - mountPath: /tmp/scripts
77 name: {{ include "common.fullname" . }}-envsubst-scripts
78 - mountPath: /config-input
79 name: {{ include "common.fullname" . }}-policy-conf-input
80 - mountPath: /config
81 name: config
Lathish818ee5d2020-08-26 13:45:03 +010082 - name: {{ include "common.name" . }}
Sylvain Desbureauxd4a6afd2020-11-21 22:01:15 +010083 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Lathish818ee5d2020-08-26 13:45:03 +010084 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
85 ports: {{ include "common.containerPorts" . | nindent 10 }}
86 readinessProbe:
87 tcpSocket:
88 port: {{ .Values.readiness.port }}
89 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
90 periodSeconds: {{ .Values.liveness.periodSeconds }}
91 livenessProbe:
92 httpGet:
93 path: /status
94 port: {{ .Values.liveness.port }}
Andreas Geissler353a8c92023-03-15 16:15:11 +010095 scheme: HTTP
Lathish818ee5d2020-08-26 13:45:03 +010096 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
97 periodSeconds: {{ .Values.liveness.periodSeconds }}
Andreas Geissler353a8c92023-03-15 16:15:11 +010098 volumeMounts:
Lathish818ee5d2020-08-26 13:45:03 +010099 - name: config
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +0100100 mountPath: /opt/app/policy-agent/data/application_configuration.json
101 subPath: application_configuration.json
102 - name: config
103 mountPath: /opt/app/policy-agent/config/application.yaml
PatrikBuhr746ff372021-04-30 15:12:51 +0200104 subPath: application.yaml
105 - name: {{ include "common.fullname" . }}
PatrikBuhr27c94362021-04-09 10:58:58 +0200106 mountPath: "/var/policy-management-service/database"
Lathish818ee5d2020-08-26 13:45:03 +0100107 resources: {{ include "common.resources" . | nindent 10 }}
farida azmy7fe88972021-09-27 20:57:13 +0200108 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Andreas Geissler353a8c92023-03-15 16:15:11 +0100109 volumes:
Lathish818ee5d2020-08-26 13:45:03 +0100110 - name: {{ include "common.fullname" . }}-policy-conf-input
111 configMap:
112 name: {{ include "common.fullname" . }}-policy-conf
Konrad Bańka52c38b92020-10-28 16:49:19 +0100113 - name: {{ include "common.fullname" . }}-envsubst-scripts
114 configMap:
115 name: {{ include "common.fullname" . }}-envsubst-scripts
Konrad Bańkaa8584622021-03-23 09:09:01 +0100116 defaultMode: 0555
Lathish818ee5d2020-08-26 13:45:03 +0100117 - name: config
118 emptyDir:
119 medium: Memory
PatrikBuhr746ff372021-04-30 15:12:51 +0200120{{- if not .Values.persistence.enabled }}
121 - name: {{ include "common.fullname" . }}
122 emptyDir: {}
123{{- else }}
124 volumeClaimTemplates:
125 - {{include "common.PVCTemplate" . | indent 6 | trim }}
126{{- end }}