blob: 6bd5b259ea3887d37307e19fe42bb3b030413b82 [file] [log] [blame]
Jakub Latusek2776cf82020-10-21 13:36:29 +02001{{/*
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +02002# 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.
Jakub Latusek2776cf82020-10-21 13:36:29 +020015*/}}
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020016
17apiVersion: apps/v1
18kind: Deployment
19metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20spec:
21 replicas: {{ .Values.replicaCount }}
22 selector: {{- include "common.selectors" . | nindent 4 }}
23 template:
24 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25 spec:
andreas-geissler6ce5c092021-07-19 17:37:10 +020026 imagePullSecrets:
27 - name: "{{ include "common.namespace" . }}-docker-registry-key"
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020028 initContainers:
29 - name: {{ include "common.name" . }}-db-readiness
30 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020031 - /app/ready.py
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020032 args:
33 - --container-name
34 {{- if .Values.global.mariadbGalera.localCluster }}
35 - ejbca-galera
36 {{- else }}
37 - ejbca-config
38 {{- end }}
39 env:
40 - name: NAMESPACE
41 valueFrom:
42 fieldRef:
43 apiVersion: v1
44 fieldPath: metadata.namespace
Sylvain Desbureaux5ee4dd42020-11-21 22:52:46 +010045 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020046 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47 containers:
48 - name: {{ include "common.name" . }}-ejbca
Sylvain Desbureaux5ee4dd42020-11-21 22:52:46 +010049 image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.ejbca.image }}
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020050 imagePullPolicy: {{ .Values.pullPolicy }}
51 lifecycle:
52 postStart:
53 exec:
54 command: ["/bin/sh", "-c", "/opt/primekey/scripts/ejbca-config.sh"]
55 volumeMounts:
56 - name: "{{ include "common.fullname" . }}-volume"
57 mountPath: /opt/primekey/scripts/
Remigiusz Janeczeked6e6212020-09-08 13:00:50 +020058 - name: "{{ include "common.fullname" . }}-profiles-volume"
59 mountPath: /opt/primekey/custom_profiles/
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020060 ports: {{ include "common.containerPorts" . | nindent 10 }}
61 env:
62 - name: INITIAL_ADMIN
63 value: ";PublicAccessAuthenticationToken:TRANSPORT_ANY;"
Piotr Marcinkiewicz31dceea2021-06-29 16:15:49 +020064 - name: NO_CREATE_CA
65 value: "true"
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020066 - name: DATABASE_JDBC_URL
67 value: jdbc:mariadb://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ .Values.mysqlDatabase }}
68 - name: DATABASE_USER
69 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "login") | indent 10 }}
70 - name: DATABASE_PASSWORD
71 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "password") | indent 10 }}
72 - name: RA_IAK
73 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-ra-iak" "key" "password") | indent 10 }}
74 - name: CLIENT_IAK
75 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-client-iak" "key" "password") | indent 10 }}
76 livenessProbe:
77 httpGet:
78 port: {{ .Values.liveness.port }}
79 path: {{ .Values.liveness.path }}
80 scheme: HTTPS
81 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
82 periodSeconds: {{ .Values.liveness.periodSeconds }}
83 readinessProbe:
84 httpGet:
85 port: {{ .Values.readiness.port }}
86 path: {{ .Values.readiness.path }}
87 scheme: HTTPS
88 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
89 periodSeconds: {{ .Values.readiness.periodSeconds }}
90 {{- if .Values.nodeSelector }}
91 nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }}
92 {{- end -}}
93 {{- if .Values.affinity }}
94 affinity: {{ toYaml .Values.affinity | nindent 10 }}
95 {{- end }}
Sylvain Desbureaux15392732020-10-22 09:49:54 +020096 resources: {{ include "common.resources" . | nindent 10 }}
farida azmye273f782021-10-02 16:04:52 +020097 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureauxd1ca1ee2020-04-07 14:52:20 +020098 volumes:
99 - configMap:
100 name: "{{ include "common.fullname" . }}-config-script"
101 defaultMode: 0755
102 name: "{{ include "common.fullname" . }}-volume"
Remigiusz Janeczeked6e6212020-09-08 13:00:50 +0200103 - configMap:
104 name: "{{ include "common.fullname" . }}-profiles"
105 defaultMode: 0755
106 name: "{{ include "common.fullname" . }}-profiles-volume"