Jakub Latusek | 83087cd | 2020-09-28 16:40:19 +0200 | [diff] [blame] | 1 | {{/*# Copyright © 2020, Nokia |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 2 | # 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 Latusek | 83087cd | 2020-09-28 16:40:19 +0200 | [diff] [blame] | 14 | # limitations under the License.*/}} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 15 | |
| 16 | {{- if .Values.global.cmpv2Enabled }} |
| 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 | 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 Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 46 | - /app/ready.py |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 47 | args: |
| 48 | - --container-name |
| 49 | - ejbca-ejbca |
| 50 | env: |
| 51 | - name: NAMESPACE |
| 52 | valueFrom: |
| 53 | fieldRef: |
| 54 | apiVersion: v1 |
| 55 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 72ea823 | 2020-11-21 21:25:40 +0100 | [diff] [blame] | 56 | image: {{ include "repositoryGenerator.image.readiness" . }} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 57 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 58 | - name: subsitute-envs |
Sylvain Desbureaux | 72ea823 | 2020-11-21 21:25:40 +0100 | [diff] [blame] | 59 | image: {{ include "repositoryGenerator.image.envsubst" . }} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 60 | 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 Desbureaux | 72ea823 | 2020-11-21 21:25:40 +0100 | [diff] [blame] | 81 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 82 | 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 Marcinkiewicz | 3267293 | 2021-03-26 13:06:35 +0100 | [diff] [blame] | 96 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "certificates-password" "key" "password") | indent 14 }} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 97 | - name: TRUSTSTORE_PASSWORD |
Piotr Marcinkiewicz | 3267293 | 2021-03-26 13:06:35 +0100 | [diff] [blame] | 98 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "certificates-password" "key" "password") | indent 14 }} |
EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 99 | 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 -}} |