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