Merge "[CONSUL] Add limits to consul chart."
[oom.git] / kubernetes / contrib / components / ejbca / templates / deployment.yaml
1 {{/*
2 # Copyright Â© 2020, Nordix Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 */}}
16
17 apiVersion: apps/v1
18 kind: Deployment
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   replicas: {{ .Values.replicaCount }}
22   selector: {{- include "common.selectors" . | nindent 4 }}
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       initContainers:
27       - name: {{ include "common.name" . }}-db-readiness
28         command:
29         - /app/ready.py
30         args:
31         - --container-name
32         {{- if .Values.global.mariadbGalera.localCluster }}
33         - ejbca-galera
34         {{- else }}
35         - ejbca-config
36         {{- end }}
37         env:
38         - name: NAMESPACE
39           valueFrom:
40             fieldRef:
41               apiVersion: v1
42               fieldPath: metadata.namespace
43         image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
44         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45       containers:
46       - name: {{ include "common.name" . }}-ejbca
47         image: {{ .Values.ejbca.image }}
48         imagePullPolicy: {{ .Values.pullPolicy }}
49         lifecycle:
50           postStart:
51             exec:
52               command: ["/bin/sh", "-c", "/opt/primekey/scripts/ejbca-config.sh"]
53         volumeMounts:
54           - name: "{{ include "common.fullname" . }}-volume"
55             mountPath: /opt/primekey/scripts/
56           - name: "{{ include "common.fullname" . }}-profiles-volume"
57             mountPath: /opt/primekey/custom_profiles/
58         ports: {{ include "common.containerPorts" . | nindent 10 }}
59         env:
60         - name: INITIAL_ADMIN
61           value: ";PublicAccessAuthenticationToken:TRANSPORT_ANY;"
62         - name: DATABASE_JDBC_URL
63           value: jdbc:mariadb://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ .Values.mysqlDatabase }}
64         - name: DATABASE_USER
65           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "login") | indent 10 }}
66         - name: DATABASE_PASSWORD
67           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "password") | indent 10 }}
68         - name: RA_IAK
69           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-ra-iak" "key" "password") | indent 10 }}
70         - name: CLIENT_IAK
71           {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-client-iak" "key" "password") | indent 10 }}
72         livenessProbe:
73           httpGet:
74             port: {{ .Values.liveness.port }}
75             path: {{ .Values.liveness.path }}
76             scheme: HTTPS
77           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
78           periodSeconds: {{ .Values.liveness.periodSeconds }}
79         readinessProbe:
80           httpGet:
81             port: {{ .Values.readiness.port }}
82             path: {{ .Values.readiness.path }}
83             scheme: HTTPS
84           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
85           periodSeconds: {{ .Values.readiness.periodSeconds }}
86           {{- if .Values.nodeSelector }}
87         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
88         {{- end -}}
89         {{- if .Values.affinity }}
90         affinity: {{ toYaml .Values.affinity | nindent 10 }}
91         {{- end }}
92       volumes:
93       - configMap:
94           name: "{{ include "common.fullname" . }}-config-script"
95           defaultMode: 0755
96         name: "{{ include "common.fullname" . }}-volume"
97       - configMap:
98           name: "{{ include "common.fullname" . }}-profiles"
99           defaultMode: 0755
100         name: "{{ include "common.fullname" . }}-profiles-volume"