From 32994df84d68c4bd9ff2def31328ed11f60a29d8 Mon Sep 17 00:00:00 2001 From: Jonathan Gautheron Date: Fri, 13 Sep 2024 10:10:29 +0200 Subject: [PATCH] feat: allow extra volumes for janitor (#702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Błaszczyk --- hacks/values/hydra.yaml | 7 +++++++ helm/charts/hydra/README.md | 2 ++ helm/charts/hydra/templates/janitor-cron-job.yaml | 6 ++++++ helm/charts/hydra/values.yaml | 10 ++++++++++ 4 files changed, 25 insertions(+) diff --git a/hacks/values/hydra.yaml b/hacks/values/hydra.yaml index 2fdbede7d..234e5ef00 100644 --- a/hacks/values/hydra.yaml +++ b/hacks/values/hydra.yaml @@ -169,6 +169,13 @@ cronjob: image: "alpine:latest" command: ["/bin/sh"] args: ["-c", "sleep infinity"] + extraVolumeMounts: + - mountPath: /testdir + name: test-volume + extraVolumes: + - name: test-volume + configMap: + name: cm-sample podMetadata: labels: ory.sh/pod_label: hydra diff --git a/helm/charts/hydra/README.md b/helm/charts/hydra/README.md index 67fe395bd..144646f0b 100644 --- a/helm/charts/hydra/README.md +++ b/helm/charts/hydra/README.md @@ -38,6 +38,8 @@ A Helm chart for deploying ORY Hydra in Kubernetes | cronjob.janitor.extraContainers | string | `""` | If you want to add extra sidecar containers. | | cronjob.janitor.extraEnv | list | `[]` | Array of extra envs to be passed to the cronjob. This takes precedence over deployment variables. Kubernetes format is expected - name: FOO value: BAR | | cronjob.janitor.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. | +| cronjob.janitor.extraVolumeMounts | list | `[]` | | +| cronjob.janitor.extraVolumes | list | `[]` | If you want to mount external volume | | cronjob.janitor.labels | object | `{}` | Set custom cron job level labels | | cronjob.janitor.nodeSelector | object | `{}` | Configure node labels for pod assignment | | cronjob.janitor.podMetadata | object | `{"annotations":{},"labels":{}}` | Specify pod metadata, this metadata is added directly to the pod, and not higher objects | diff --git a/helm/charts/hydra/templates/janitor-cron-job.yaml b/helm/charts/hydra/templates/janitor-cron-job.yaml index 242138b44..aa52036fd 100644 --- a/helm/charts/hydra/templates/janitor-cron-job.yaml +++ b/helm/charts/hydra/templates/janitor-cron-job.yaml @@ -52,6 +52,9 @@ spec: - name: {{ include "hydra.name" . }}-config-volume configMap: name: {{ include "hydra.fullname" . }} + {{- if .Values.cronjob.janitor.extraVolumes }} + {{- toYaml .Values.cronjob.janitor.extraVolumes | nindent 12 }} + {{- end }} containers: - name: janitor image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -105,6 +108,9 @@ spec: - name: {{ include "hydra.name" . }}-config-volume mountPath: /etc/config readOnly: true + {{- if .Values.cronjob.janitor.extraVolumeMounts }} + {{- toYaml .Values.cronjob.janitor.extraVolumeMounts | nindent 16 }} + {{- end }} {{- if .Values.cronjob.janitor.extraContainers }} {{- tpl .Values.cronjob.janitor.extraContainers . | nindent 12 }} {{- end }} diff --git a/helm/charts/hydra/values.yaml b/helm/charts/hydra/values.yaml index 711b1191b..34bc71627 100644 --- a/helm/charts/hydra/values.yaml +++ b/helm/charts/hydra/values.yaml @@ -551,6 +551,16 @@ cronjob: # - name: ... # image: ... + # -- If you want to mount external volume + extraVolumes: [] + # - name: my-volume + # secret: + # secretName: my-secret + extraVolumeMounts: [] + # - name: my-volume + # mountPath: /etc/secrets/my-secret + # readOnly: true + # -- Set custom cron job level labels labels: {}