Sylvain Desbureaux | d1ca1ee | 2020-04-07 14:52:20 +0200 | [diff] [blame] | 1 | # 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 | |
| 15 | apiVersion: apps/v1 |
| 16 | kind: Deployment |
| 17 | metadata: {{- include "common.resourceMetadata" . | nindent 2 }} |
| 18 | spec: |
| 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 Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame^] | 27 | - /app/ready.py |
Sylvain Desbureaux | d1ca1ee | 2020-04-07 14:52:20 +0200 | [diff] [blame] | 28 | 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 Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame^] | 41 | image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}" |
Sylvain Desbureaux | d1ca1ee | 2020-04-07 14:52:20 +0200 | [diff] [blame] | 42 | 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/ |
| 54 | ports: {{ include "common.containerPorts" . | nindent 10 }} |
| 55 | env: |
| 56 | - name: INITIAL_ADMIN |
| 57 | value: ";PublicAccessAuthenticationToken:TRANSPORT_ANY;" |
| 58 | - name: DATABASE_JDBC_URL |
| 59 | value: jdbc:mariadb://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ .Values.mysqlDatabase }} |
| 60 | - name: DATABASE_USER |
| 61 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "login") | indent 10 }} |
| 62 | - name: DATABASE_PASSWORD |
| 63 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-db-secret" "key" "password") | indent 10 }} |
| 64 | - name: RA_IAK |
| 65 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-ra-iak" "key" "password") | indent 10 }} |
| 66 | - name: CLIENT_IAK |
| 67 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "ejbca-server-client-iak" "key" "password") | indent 10 }} |
| 68 | livenessProbe: |
| 69 | httpGet: |
| 70 | port: {{ .Values.liveness.port }} |
| 71 | path: {{ .Values.liveness.path }} |
| 72 | scheme: HTTPS |
| 73 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 74 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 75 | readinessProbe: |
| 76 | httpGet: |
| 77 | port: {{ .Values.readiness.port }} |
| 78 | path: {{ .Values.readiness.path }} |
| 79 | scheme: HTTPS |
| 80 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 81 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 82 | {{- if .Values.nodeSelector }} |
| 83 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 84 | {{- end -}} |
| 85 | {{- if .Values.affinity }} |
| 86 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 87 | {{- end }} |
| 88 | volumes: |
| 89 | - configMap: |
| 90 | name: "{{ include "common.fullname" . }}-config-script" |
| 91 | defaultMode: 0755 |
| 92 | name: "{{ include "common.fullname" . }}-volume" |