EmmettCox | bca68e0 | 2020-02-27 14:20:52 +0000 | [diff] [blame] | 1 | # Copyright © 2020, Nokia |
| 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 |
| 14 | # limitations under the License. |
| 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: |
| 46 | - /root/ready.py |
| 47 | args: |
| 48 | - --container-name |
| 49 | - ejbca-ejbca |
| 50 | env: |
| 51 | - name: NAMESPACE |
| 52 | valueFrom: |
| 53 | fieldRef: |
| 54 | apiVersion: v1 |
| 55 | fieldPath: metadata.namespace |
| 56 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 57 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 58 | - name: subsitute-envs |
| 59 | image: "{{ .Values.global.envsubstImage }}" |
| 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" . }} |
| 81 | image: {{ .Values.repository }}/{{ .Values.image }} |
| 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 |
| 96 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "keystore-password" "key" "password") | indent 14 }} |
| 97 | - name: TRUSTSTORE_PASSWORD |
| 98 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "truststore-password" "key" "password") | indent 14 }} |
| 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 -}} |