blob: 8215ed949ef622a9ae6f20cc2a99012e3a58dd3b [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:
andreas-geissler5389da82021-07-19 17:46:31 +020026 imagePullSecrets:
27 - name: "{{ include "common.namespace" . }}-docker-registry-key"
EmmettCoxbca68e02020-02-27 14:20:52 +000028 volumes:
29{{- if .Values.global.addTestingComponents }}
30 - name: cmp-servers-template-volume
31 secret:
32 secretName: {{ .Values.cmpServers.secret.name }}
33 - name: {{ .Values.cmpServers.volume.name }}
34 emptyDir:
35 medium: Memory
36{{- else }}
37 - name: {{ .Values.cmpServers.volume.name }}
38 secret:
39 secretName: {{ .Values.cmpServers.secret.name }}
40{{- end }}
41 - name: {{ .Values.tls.server.volume.name }}
42 secret:
43 secretName: {{ .Values.tls.server.secret.name }}
44{{- if .Values.global.addTestingComponents }}
45 initContainers:
46 - name: wait-for-ejbca
47 command:
Sylvain Desbureaux1694e1d2020-08-21 09:58:25 +020048 - /app/ready.py
EmmettCoxbca68e02020-02-27 14:20:52 +000049 args:
50 - --container-name
51 - ejbca-ejbca
52 env:
53 - name: NAMESPACE
54 valueFrom:
55 fieldRef:
56 apiVersion: v1
57 fieldPath: metadata.namespace
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010058 image: {{ include "repositoryGenerator.image.readiness" . }}
EmmettCoxbca68e02020-02-27 14:20:52 +000059 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60 - name: subsitute-envs
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010061 image: {{ include "repositoryGenerator.image.envsubst" . }}
EmmettCoxbca68e02020-02-27 14:20:52 +000062 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
63 command: ['sh', '-c', "cd /config-input && envsubst < cmpServers.json > {{ .Values.cmpServers.volume.mountPath }}/cmpServers.json"]
64 volumeMounts:
65 - name: cmp-servers-template-volume
66 mountPath: /config-input
67 readOnly: true
68 - name: {{ .Values.cmpServers.volume.name }}
69 mountPath: {{ .Values.cmpServers.volume.mountPath }}
70 readOnly: false
71 env:
72 - name: CLIENT_IAK
73 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-client-iak" "key" "password") | indent 14 }}
74 - name: CLIENT_RV
75 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmp-config-client-rv" "key" "password") | indent 14 }}
76 - name: RA_IAK
77 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-ra-iak" "key" "password") | indent 14 }}
78 - name: RA_RV
79 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmp-config-ra-rv" "key" "password") | indent 14 }}
80{{- end }}
81 containers:
82 - name: {{ include "common.name" . }}
Sylvain Desbureaux72ea8232020-11-21 21:25:40 +010083 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
EmmettCoxbca68e02020-02-27 14:20:52 +000084 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
85 ports: {{ include "common.containerPorts" . | nindent 10 }}
86 env:
87 - name: HTTPS_PORT
88 value: "{{ .Values.envs.httpsPort }}"
89 - name: KEYSTORE_PATH
90 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.keystore.jksName }}"
91 - name: KEYSTORE_P12_PATH
92 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.keystore.p12Name }}"
93 - name: TRUSTSTORE_PATH
94 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.truststore.jksName }}"
95 - name: ROOT_CERT
96 value: "{{ .Values.tls.server.volume.mountPath }}/{{ .Values.envs.truststore.crtName }}"
97 - name: KEYSTORE_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 - name: TRUSTSTORE_PASSWORD
Piotr Marcinkiewicz32672932021-03-26 13:06:35 +0100100 {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "certificates-password" "key" "password") | indent 14 }}
EmmettCoxbca68e02020-02-27 14:20:52 +0000101 livenessProbe:
102 exec:
103 command:
104 - /bin/bash
105 - -c
106 - {{ .Values.liveness.command }}
107 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
108 periodSeconds: {{ .Values.liveness.periodSeconds }}
109 readinessProbe:
110 exec:
111 command:
112 - /bin/bash
113 - -c
114 - {{ .Values.readiness.command }}
115 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
116 periodSeconds: {{ .Values.readiness.periodSeconds }}
117 volumeMounts:
118 - name: {{ .Values.cmpServers.volume.name }}
119 mountPath: {{ .Values.cmpServers.volume.mountPath }}
120 readOnly: false
121 - name: {{ .Values.tls.server.volume.name }}
122 mountPath: {{ .Values.tls.server.volume.mountPath }}
123 readOnly: true
124 resources: {{ include "common.resources" . | nindent 12 }}
125{{ end -}}