blob: 9a6abd4eb9cac4085d4abc71c3a6951f4f7a4a36 [file] [log] [blame]
Jakub Latusek83087cd2020-09-28 16:40:19 +02001{{/*# Copyright © 2020, Nokia
EmmettCoxbca68e02020-02-27 14:20:52 +00002# Modifications 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
Jakub Latusek83087cd2020-09-28 16:40:19 +020014# limitations under the License.*/}}
EmmettCoxbca68e02020-02-27 14:20:52 +000015
16{{- if .Values.global.cmpv2Enabled }}
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:
26 volumes:
27{{- if .Values.global.addTestingComponents }}
28 - name: cmp-servers-template-volume
29 secret:
30 secretName: {{ .Values.cmpServers.secret.name }}
31 - name: {{ .Values.cmpServers.volume.name }}
32 emptyDir:
33 medium: Memory
34{{- else }}
35 - name: {{ .Values.cmpServers.volume.name }}
36 secret:
37 secretName: {{ .Values.cmpServers.secret.name }}
38{{- end }}
39 - name: {{ .Values.tls.server.volume.name }}
40 secret:
41 secretName: {{ .Values.tls.server.secret.name }}
42{{- if .Values.global.addTestingComponents }}
43 initContainers:
44 - name: wait-for-ejbca
45 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020046 - /app/ready.py
EmmettCoxbca68e02020-02-27 14:20:52 +000047 args:
48 - --container-name
49 - ejbca-ejbca
50 env:
51 - name: NAMESPACE
52 valueFrom:
53 fieldRef:
54 apiVersion: v1
55 fieldPath: metadata.namespace
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010056 image: {{ include "repositoryGenerator.image.readiness" . }}
EmmettCoxbca68e02020-02-27 14:20:52 +000057 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58 - name: subsitute-envs
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010059 image: {{ include "repositoryGenerator.image.envsubst" . }}
EmmettCoxbca68e02020-02-27 14:20:52 +000060 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61 command: ['sh', '-c', "cd /config-input && envsubst < cmpServers.json > {{ .Values.cmpServers.volume.mountPath }}/cmpServers.json"]
62 volumeMounts:
63 - name: cmp-servers-template-volume
64 mountPath: /config-input
65 readOnly: true
66 - name: {{ .Values.cmpServers.volume.name }}
67 mountPath: {{ .Values.cmpServers.volume.mountPath }}
68 readOnly: false
69 env:
70 - name: CLIENT_IAK
71 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-client-iak" "key" "password") | indent 14 }}
72 - name: CLIENT_RV
73 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmp-config-client-rv" "key" "password") | indent 14 }}
74 - name: RA_IAK
75 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-ra-iak" "key" "password") | indent 14 }}
76 - name: RA_RV
77 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmp-config-ra-rv" "key" "password") | indent 14 }}
78{{- end }}
79 containers:
80 - name: {{ include "common.name" . }}
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010081 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
EmmettCoxbca68e02020-02-27 14:20:52 +000082 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
83 ports: {{ include "common.containerPorts" . | nindent 10 }}
84 env:
85 - name: HTTPS_PORT
86 value: "{{ .Values.envs.httpsPort }}"
87 - name: KEYSTORE_PATH
88 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.keystore.jksName }}"
89 - name: KEYSTORE_P12_PATH
90 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.keystore.p12Name }}"
91 - name: TRUSTSTORE_PATH
92 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.truststore.jksName }}"
93 - name: ROOT_CERT
94 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.truststore.crtName }}"
95 - name: KEYSTORE_PASSWORD
Piotr Marcinkiewicz32672932021-03-26 13:06:35 +010096 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "certificates-password" "key" "password") | indent 14 }}
EmmettCoxbca68e02020-02-27 14:20:52 +000097 - name: TRUSTSTORE_PASSWORD
Piotr Marcinkiewicz32672932021-03-26 13:06:35 +010098 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "certificates-password" "key" "password") | indent 14 }}
EmmettCoxbca68e02020-02-27 14:20:52 +000099 livenessProbe:
100 exec:
101 command:
102 - /bin/bash
103 - -c
104 - {{ .Values.liveness.command }}
105 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
106 periodSeconds: {{ .Values.liveness.periodSeconds }}
107 readinessProbe:
108 exec:
109 command:
110 - /bin/bash
111 - -c
112 - {{ .Values.readiness.command }}
113 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
114 periodSeconds: {{ .Values.readiness.periodSeconds }}
115 volumeMounts:
116 - name: {{ .Values.cmpServers.volume.name }}
117 mountPath: {{ .Values.cmpServers.volume.mountPath }}
118 readOnly: false
119 - name: {{ .Values.tls.server.volume.name }}
120 mountPath: {{ .Values.tls.server.volume.mountPath }}
121 readOnly: true
122 resources: {{ include "common.resources" . | nindent 12 }}
123{{ end -}}