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 |
| 22 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 23 | spec: |
| 24 | replicas: {{ index .Values.replicaCount }} |
| 25 | selector: {{- include "common.selectors" . | nindent 4 }} |
| 26 | template: |
| 27 | metadata: |
| 28 | labels: {{- include "common.labels" . | nindent 8 }} |
| 29 | spec: |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 30 | initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }} |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 31 | - name: {{ include "common.name" . }}-bootstrap-config |
Sylvain Desbureaux | d4a6afd | 2020-11-21 22:01:15 +0100 | [diff] [blame] | 32 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 33 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 34 | command: |
| 35 | - sh |
| 36 | args: |
| 37 | - -c |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 38 | - | |
| 39 | export $(cat {{ .Values.certInitializer.credsPath }}/mycreds.prop\ |
| 40 | | xargs -0) |
| 41 | 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 |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 48 | 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 }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 53 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 54 | - mountPath: /config-input |
| 55 | name: {{ include "common.fullname" . }}-policy-conf-input |
| 56 | - mountPath: /config |
| 57 | name: config |
| 58 | containers: |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 59 | - name: {{ include "common.name" . }}-update-config |
| 60 | image: "{{ .Values.global.envsubstImage }}" |
| 61 | 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 |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 82 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | d4a6afd | 2020-11-21 22:01:15 +0100 | [diff] [blame] | 83 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 84 | 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 }} |
| 95 | scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }} |
| 96 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 97 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 98 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 99 | - name: config |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 100 | 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 |
| 104 | subPath: application.yaml |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 105 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | b5353c9 | 2021-02-15 11:30:29 +0100 | [diff] [blame] | 106 | volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }} |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 107 | - name: {{ include "common.fullname" . }}-policy-conf-input |
| 108 | configMap: |
| 109 | name: {{ include "common.fullname" . }}-policy-conf |
Konrad Bańka | 52c38b9 | 2020-10-28 16:49:19 +0100 | [diff] [blame] | 110 | defaultMode: 0555 |
| 111 | - name: {{ include "common.fullname" . }}-envsubst-scripts |
| 112 | configMap: |
| 113 | name: {{ include "common.fullname" . }}-envsubst-scripts |
Lathish | 818ee5d | 2020-08-26 13:45:03 +0100 | [diff] [blame] | 114 | - name: config |
| 115 | emptyDir: |
| 116 | medium: Memory |