blob: 0d8399c8b357bd3047a74cdedab146cff3be8ab8 [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
20kind: Deployment
21apiVersion: apps/v1
PatrikBuhr27c94362021-04-09 10:58:58 +020022metadata:
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 }}"
Lathish818ee5d2020-08-26 13:45:03 +010030spec:
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 Desbureauxb5353c92021-02-15 11:30:29 +010037 initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
Konrad Bańka52c38b92020-10-28 16:49:19 +010038 - name: {{ include "common.name" . }}-bootstrap-config
Sylvain Desbureauxd4a6afd2020-11-21 22:01:15 +010039 image: {{ include "repositoryGenerator.image.envsubst" . }}
Lathish818ee5d2020-08-26 13:45:03 +010040 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
41 command:
42 - sh
43 args:
44 - -c
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +010045 - |
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
Lathish818ee5d2020-08-26 13:45:03 +010055 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 Desbureauxb5353c92021-02-15 11:30:29 +010060 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Lathish818ee5d2020-08-26 13:45:03 +010061 - mountPath: /config-input
62 name: {{ include "common.fullname" . }}-policy-conf-input
63 - mountPath: /config
64 name: config
65 containers:
Konrad Bańka52c38b92020-10-28 16:49:19 +010066 - 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
Lathish818ee5d2020-08-26 13:45:03 +010089 - name: {{ include "common.name" . }}
Sylvain Desbureauxd4a6afd2020-11-21 22:01:15 +010090 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Lathish818ee5d2020-08-26 13:45:03 +010091 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 Desbureauxb5353c92021-02-15 11:30:29 +0100105 volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 8 }}
Lathish818ee5d2020-08-26 13:45:03 +0100106 - name: config
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +0100107 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
PatrikBuhr27c94362021-04-09 10:58:58 +0200111 subPath: application.yaml
112 - name: vardata
113 mountPath: "/var/policy-management-service/database"
Lathish818ee5d2020-08-26 13:45:03 +0100114 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureauxb5353c92021-02-15 11:30:29 +0100115 volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
Lathish818ee5d2020-08-26 13:45:03 +0100116 - name: {{ include "common.fullname" . }}-policy-conf-input
117 configMap:
118 name: {{ include "common.fullname" . }}-policy-conf
Konrad Bańka52c38b92020-10-28 16:49:19 +0100119 - name: {{ include "common.fullname" . }}-envsubst-scripts
120 configMap:
121 name: {{ include "common.fullname" . }}-envsubst-scripts
Konrad Bańkaa8584622021-03-23 09:09:01 +0100122 defaultMode: 0555
Lathish818ee5d2020-08-26 13:45:03 +0100123 - name: config
124 emptyDir:
125 medium: Memory
PatrikBuhr27c94362021-04-09 10:58:58 +0200126 - name: vardata
127 persistentVolumeClaim:
128 claimName: {{ include "common.fullname" . }}