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