Skip to content

Commit

Permalink
feat: allow extra volumes for janitor (#702)
Browse files Browse the repository at this point in the history
Co-authored-by: Jakub Błaszczyk <[email protected]>
  • Loading branch information
jgautheron and Demonsthere committed Sep 13, 2024
1 parent fe49daa commit 32994df
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hacks/values/hydra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions helm/charts/hydra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
6 changes: 6 additions & 0 deletions helm/charts/hydra/templates/janitor-cron-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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 }}
Expand Down
10 changes: 10 additions & 0 deletions helm/charts/hydra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}

Expand Down

0 comments on commit 32994df

Please sign in to comment.