Skip to content

Commit

Permalink
feat: add extraContainers and extraInitContainers to Hydra Janitor (#644
Browse files Browse the repository at this point in the history
)
  • Loading branch information
supercairos authored Oct 30, 2023
1 parent 873b5f3 commit 9c86e7b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hacks/values/hydra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ cronjob:
ory.sh/test: hydra
annotations:
ory.sh/test: hydra
extraInitContainers: |
- name: "hello-world"
image: "alpine:latest"
command: ["/bin/sh"]
args: ["-c", "echo hello, world!"]
extraContainers: |
- name: "sidecar"
image: "alpine:latest"
command: ["/bin/sh"]
args: ["-c", "sleep infinity"]
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 @@ -34,6 +34,8 @@ A Helm chart for deploying ORY Hydra in Kubernetes
| cronjob.janitor.annotations | object | `{}` | Set custom cron job level annotations |
| cronjob.janitor.customArgs | list | `[]` | Configure the arguments of the entrypoint, overriding the default value |
| 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.extraContainers | string | `""` | If you want to add extra sidecar containers. |
| cronjob.janitor.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. |
| 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
7 changes: 7 additions & 0 deletions helm/charts/hydra/templates/janitor-cron-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ spec:
- name: {{ include "hydra.name" . }}-config-volume
mountPath: /etc/config
readOnly: true
{{- if .Values.cronjob.janitor.extraContainers }}
{{- tpl .Values.cronjob.janitor.extraContainers . | nindent 12 }}
{{- end }}
{{- if .Values.cronjob.janitor.extraInitContainers }}
initContainers:
{{- tpl .Values.cronjob.janitor.extraInitContainers . | nindent 10 }}
{{- end }}
{{- with .Values.cronjob.janitor.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
Expand Down
12 changes: 12 additions & 0 deletions helm/charts/hydra/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,18 @@ cronjob:
# value: BAR
extraEnv: []

# -- If you want to add extra init containers. These are processed before the migration init container.
extraInitContainers: ""
# extraInitContainers: |
# - name: ...
# image: ...

# -- If you want to add extra sidecar containers.
extraContainers: ""
# extraContainers: |
# - name: ...
# image: ...

# -- Set custom cron job level labels
labels: {}

Expand Down

0 comments on commit 9c86e7b

Please sign in to comment.