6987bd41c514fc39af17b6c1bf7a92f0634f5d8c
[oom.git] / kubernetes / a1policymanagement / templates / deployment.yaml
1 {{/*
2 ################################################################################
3 #   Copyright (c) 2020 Nordix Foundation.                                      #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 */}}
18
19 kind: Deployment
20 apiVersion: apps/v1
21 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 spec:
23   replicas: {{ index .Values.replicaCount }}
24   selector: {{- include "common.selectors" . | nindent 4 }}
25   template:
26     metadata:
27       labels: {{- include "common.labels" . | nindent 8 }}
28     spec:
29       initContainers:
30       - name: {{ include "common.name" . }}-update-config
31         image: "{{ .Values.global.envsubstImage }}"
32         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
33         command:
34         - sh
35         args:
36         - -c
37         - "cd /config-input && for PFILE in `ls -1`; do envsubst <${PFILE} >/config/${PFILE}; done"
38         env:
39         - name: A1CONTROLLER_USER
40           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "login") | indent 10 }}
41         - name: A1CONTROLLER_PASSWORD
42           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "controller-secret" "key" "password") | indent 10 }}
43         volumeMounts:
44         - mountPath: /config-input
45           name: {{ include "common.fullname" . }}-policy-conf-input
46         - mountPath: /config
47           name: config
48       containers:
49       - name: {{ include "common.name" . }}
50         image: {{ include "common.repository" . }}/{{ .Values.image }}
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         ports: {{ include "common.containerPorts" . | nindent 10  }}
53         readinessProbe:
54           tcpSocket:
55             port: {{ .Values.readiness.port }}
56           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
57           periodSeconds: {{ .Values.liveness.periodSeconds }}
58         livenessProbe:
59           httpGet:
60             path: /status
61             port: {{ .Values.liveness.port }}
62             scheme: {{ if (include "common.needTLS" .) }}HTTPS{{ else }}HTTP{{ end }}
63           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
64           periodSeconds: {{ .Values.liveness.periodSeconds }}
65         volumeMounts:
66         - name: config
67           mountPath: /opt/app/policy-agent/data
68         resources: {{ include "common.resources" . | nindent 10 }}
69       volumes:
70         - name: {{ include "common.fullname" . }}-policy-conf-input
71           configMap:
72             name: {{ include "common.fullname" . }}-policy-conf
73         - name: config
74           emptyDir:
75             medium: Memory