|
| 1 | +{{- if .Values.initKeyStore.enabled -}} |
| 2 | + |
| 3 | +{{/* Define common volume mounts for reusability */}} |
| 4 | +{{- $commonVolumeMounts := list }} |
| 5 | +{{- $commonVolumeMounts = append $commonVolumeMounts (dict "mountPath" "/entrypoint.sh" "name" "container-entrypoint" "subPath" "entrypoint.sh") }} |
| 6 | +{{- if and .Values.developer.enabled .Values.developer.mountedPythonModulesToInstall }} |
| 7 | +{{- $commonVolumeMounts = append $commonVolumeMounts (dict "mountPath" .Values.developer.sourcePath "name" "diracx-code-mount" "readOnly" true) }} |
| 8 | +{{- range $module := .Values.developer.mountedPythonModulesToInstall }} |
| 9 | +{{- if $.Values.developer.editableMountedPythonModules }} |
| 10 | +{{- $commonVolumeMounts = append $commonVolumeMounts (dict "mountPath" (printf "%s/%s/src/%s.egg-info" $.Values.developer.sourcePath $module (replace "-" "_" (base $module))) "name" (printf "%s-editable-install" (base $module | lower)) "readOnly" false) }} |
| 11 | +{{- else }} |
| 12 | +{{- $commonVolumeMounts = append $commonVolumeMounts (dict "mountPath" (printf "%s/%s/build" $.Values.developer.sourcePath $module (replace "-" "_" (base $module))) "name" (printf "%s-editable-install" (base $module | lower)) "readOnly" false) }} |
| 13 | +{{- end }} |
| 14 | +{{- end }} |
| 15 | +{{- end }} |
| 16 | + |
| 17 | +apiVersion: batch/v1 |
| 18 | +kind: Job |
| 19 | +metadata: |
| 20 | + name: {{ template "initKeyStore.jobname" . }} |
| 21 | + namespace: {{ .Release.Namespace }} |
| 22 | + annotations: |
| 23 | + "helm.sh/hook": pre-install |
| 24 | +spec: |
| 25 | + ttlSecondsAfterFinished: {{ .Values.global.batchJobTTL }} |
| 26 | + activeDeadlineSeconds: {{ .Values.global.activeDeadlineSeconds }} |
| 27 | + template: |
| 28 | + spec: |
| 29 | + restartPolicy: Never |
| 30 | + serviceAccountName: {{ template "initSecrets.serviceAccountName" . }} |
| 31 | + initContainers: |
| 32 | + - name: {{ .Chart.Name }}-init-keystore |
| 33 | + image: "{{ .Values.global.images.services }}:{{ .Values.global.images.tag | default .Chart.AppVersion }}" |
| 34 | + imagePullPolicy: {{ .Values.global.imagePullPolicy }} |
| 35 | + command: ["/bin/bash", "/entrypoint.sh"] |
| 36 | + args: ["/bin/bash", "/scripts/init-keystore"] |
| 37 | + volumeMounts: |
| 38 | + {{ toYaml $commonVolumeMounts | nindent 12 }} |
| 39 | + - name: scripts |
| 40 | + mountPath: /scripts |
| 41 | + - name: keystore |
| 42 | + mountPath: /keystore |
| 43 | + |
| 44 | + containers: |
| 45 | + - name: {{ .Chart.Name }}-load-keystore-as-secret |
| 46 | + image: ghcr.io/diracgrid/diracx/secret-generation:latest |
| 47 | + imagePullPolicy: {{ .Values.global.imagePullPolicy }} |
| 48 | + args: ["/bin/bash", "/scripts/load-keystore-as-secret"] |
| 49 | + volumeMounts: |
| 50 | + - name: scripts |
| 51 | + mountPath: /scripts |
| 52 | + - name: keystore |
| 53 | + mountPath: /keystore |
| 54 | + volumes: |
| 55 | + - name: keystore |
| 56 | + emptyDir: {} |
| 57 | + - name: scripts |
| 58 | + configMap: |
| 59 | + name: {{ template "initKeyStore.fullname" . }} |
| 60 | + {{- if and .Values.developer.enabled .Values.developer.mountedPythonModulesToInstall }} |
| 61 | + - name: diracx-code-mount |
| 62 | + persistentVolumeClaim: |
| 63 | + claimName: pvc-diracx-code |
| 64 | + {{- range $module := .Values.developer.mountedPythonModulesToInstall }} |
| 65 | + - name: {{ base $module | lower }}-editable-install |
| 66 | + emptyDir: |
| 67 | + sizeLimit: 5Mi |
| 68 | + {{- end }} |
| 69 | + {{- end }} |
| 70 | + - name: container-entrypoint |
| 71 | + configMap: |
| 72 | + name: diracx-container-entrypoint |
| 73 | +{{- end }} |
0 commit comments