|
| 1 | +{{- if .Values.cleanupAuthDB.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: CronJob |
| 19 | +metadata: |
| 20 | + name: {{ template "cleanupAuthDB.fullname" . }} |
| 21 | + namespace: {{ .Release.Namespace }} |
| 22 | +spec: |
| 23 | + schedule: {{ $.Values.cleanupAuthDB.schedule }} |
| 24 | + jobTemplate: |
| 25 | + spec: |
| 26 | + template: |
| 27 | + spec: |
| 28 | + restartPolicy: OnFailure |
| 29 | + containers: |
| 30 | + - name: {{ .Chart.Name }}-cleanup |
| 31 | + image: "{{ include "diracx.servicesImage" . }}" |
| 32 | + command: ["/bin/bash", "/entrypoint.sh"] |
| 33 | + args: ["/bin/bash", "/scripts/cleanup-authdb"] |
| 34 | + envFrom: |
| 35 | + - secretRef: |
| 36 | + name: diracx-secrets |
| 37 | + - secretRef: |
| 38 | + name: diracx-sql-connection-urls |
| 39 | + - secretRef: |
| 40 | + name: diracx-dynamic-secrets |
| 41 | + volumeMounts: |
| 42 | + {{ toYaml $commonVolumeMounts | nindent 16 }} |
| 43 | + - name: keystore |
| 44 | + mountPath: /keystore/jwks.json |
| 45 | + subPath: jwks.json |
| 46 | + - name: scripts |
| 47 | + mountPath: /scripts |
| 48 | + volumes: |
| 49 | + - name: keystore |
| 50 | + secret: |
| 51 | + secretName: diracx-jwks |
| 52 | + items: |
| 53 | + - key: jwks.json |
| 54 | + path: jwks.json |
| 55 | + - name: scripts |
| 56 | + configMap: |
| 57 | + name: {{ template "cleanupAuthDB.fullname" . }} |
| 58 | + {{- if and .Values.developer.enabled .Values.developer.mountedPythonModulesToInstall }} |
| 59 | + - name: diracx-code-mount |
| 60 | + persistentVolumeClaim: |
| 61 | + claimName: pvc-diracx-code |
| 62 | + {{- range $module := .Values.developer.mountedPythonModulesToInstall }} |
| 63 | + - name: {{ base $module | lower }}-editable-install |
| 64 | + emptyDir: |
| 65 | + sizeLimit: 5Mi |
| 66 | + {{- end }} |
| 67 | + {{- end }} |
| 68 | + - name: container-entrypoint |
| 69 | + configMap: |
| 70 | + name: diracx-container-entrypoint |
| 71 | +{{- end -}} |
0 commit comments