Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 1 | {{/* |
| 2 | ################################################################################ |
| 3 | # Copyright (c) 2020 Nordix Foundation. # |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 4 | # Copyright © 2020 Samsung Electronics, Modifications # |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 5 | # # |
| 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 | |
PatrikBuhr | 746ff37 | 2021-04-30 15:12:51 +0200 | [diff] [blame] | 20 | kind: StatefulSet |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 21 | apiVersion: apps/v1 |
PatrikBuhr | 746ff37 | 2021-04-30 15:12:51 +0200 | [diff] [blame] | 22 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 23 | spec: |
PatrikBuhr | 746ff37 | 2021-04-30 15:12:51 +0200 | [diff] [blame] | 24 | serviceName: {{ include "common.servicename" . }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 25 | 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 Geissler | 3f5a614 | 2021-11-24 14:01:31 +0000 | [diff] [blame] | 31 | imagePullSecrets: |
| 32 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 33 | initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }} |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 34 | - name: {{ include "common.name" . }}-bootstrap-config |
Sylvain Desbureaux | d4a6afd | 2020-11-21 22:01:15 +0100 | [diff] [blame] | 35 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 36 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 37 | command: |
| 38 | - sh |
| 39 | args: |
| 40 | - -c |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 41 | - | |
Andreas Geissler | ebc3a0b | 2022-09-22 15:35:46 +0200 | [diff] [blame] | 42 | {{- if (include "common.needTLS" .) }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 43 | export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop\ |
| 44 | | xargs -0) |
Andreas Geissler | ebc3a0b | 2022-09-22 15:35:46 +0200 | [diff] [blame] | 45 | {{- end }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 46 | cd /config-input |
| 47 | for PFILE in `ls -1` |
| 48 | do |
| 49 | envsubst <${PFILE} >/config/${PFILE} |
| 50 | chmod o+w /config/${PFILE} |
| 51 | done |
| 52 | cat /config/application.yaml |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 53 | env: |
| 54 | - name: A1CONTROLLER_USER |
| 55 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "login") | indent 10 }} |
| 56 | - name: A1CONTROLLER_PASSWORD |
| 57 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "password") | indent 10 }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 58 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 59 | - mountPath: /config-input |
| 60 | name: {{ include "common.fullname" . }}-policy-conf-input |
| 61 | - mountPath: /config |
| 62 | name: config |
| 63 | containers: |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 64 | - name: {{ include "common.name" . }}-update-config |
Andreas Geissler | 3f5a614 | 2021-11-24 14:01:31 +0000 | [diff] [blame] | 65 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 66 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 67 | securityContext: |
| 68 | runAsGroup: {{ .Values.groupID }} |
| 69 | runAsUser: {{ .Values.userID }} |
| 70 | runAsNonRoot: true |
| 71 | command: |
| 72 | - sh |
| 73 | args: |
| 74 | - /tmp/scripts/daemon.sh |
| 75 | env: |
| 76 | - name: A1CONTROLLER_USER |
| 77 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "login") | indent 10 }} |
| 78 | - name: A1CONTROLLER_PASSWORD |
| 79 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "password") | indent 10 }} |
| 80 | volumeMounts: |
| 81 | - mountPath: /tmp/scripts |
| 82 | name: {{ include "common.fullname" . }}-envsubst-scripts |
| 83 | - mountPath: /config-input |
| 84 | name: {{ include "common.fullname" . }}-policy-conf-input |
| 85 | - mountPath: /config |
| 86 | name: config |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 87 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | d4a6afd | 2020-11-21 22:01:15 +0100 | [diff] [blame] | 88 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 89 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 90 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 91 | readinessProbe: |
| 92 | tcpSocket: |
| 93 | port: {{ .Values.readiness.port }} |
| 94 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 95 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 96 | livenessProbe: |
| 97 | httpGet: |
| 98 | path: /status |
| 99 | port: {{ .Values.liveness.port }} |
| 100 | scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }} |
| 101 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 102 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 103 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 104 | - name: config |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 105 | mountPath: /opt/app/policy-agent/data/application_configuration.json |
| 106 | subPath: application_configuration.json |
| 107 | - name: config |
| 108 | mountPath: /opt/app/policy-agent/config/application.yaml |
PatrikBuhr | 746ff37 | 2021-04-30 15:12:51 +0200 | [diff] [blame] | 109 | subPath: application.yaml |
| 110 | - name: {{ include "common.fullname" . }} |
PatrikBuhr | 27c9436 | 2021-04-09 10:58:58 +0200 | [diff] [blame] | 111 | mountPath: "/var/policy-management-service/database" |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 112 | resources: {{ include "common.resources" . | nindent 10 }} |
farida azmy | 7fe8897 | 2021-09-27 20:57:13 +0200 | [diff] [blame] | 113 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 114 | volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 115 | - name: {{ include "common.fullname" . }}-policy-conf-input |
| 116 | configMap: |
| 117 | name: {{ include "common.fullname" . }}-policy-conf |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 118 | - name: {{ include "common.fullname" . }}-envsubst-scripts |
| 119 | configMap: |
| 120 | name: {{ include "common.fullname" . }}-envsubst-scripts |
Konrad Bańka | a858462 | 2021-03-23 09:09:01 +0100 | [diff] [blame] | 121 | defaultMode: 0555 |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 122 | - name: config |
| 123 | emptyDir: |
| 124 | medium: Memory |
PatrikBuhr | 746ff37 | 2021-04-30 15:12:51 +0200 | [diff] [blame] | 125 | {{- if not .Values.persistence.enabled }} |
| 126 | - name: {{ include "common.fullname" . }} |
| 127 | emptyDir: {} |
| 128 | {{- else }} |
| 129 | volumeClaimTemplates: |
| 130 | - {{include "common.PVCTemplate" . | indent 6 | trim }} |
| 131 | {{- end }} |