Skip to content

Commit 85bc64b

Browse files
authored
feat: extraEnv templates (#704)
1 parent 2789805 commit 85bc64b

20 files changed

+69
-42
lines changed

hacks/values/hydra.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ deployment:
8080
extraEnv:
8181
- name: FOO
8282
value: BAR
83+
- name: RELEASE_NAME
84+
value: "{{ .Release.Name }}"
8385
extraVolumeMounts:
8486
- mountPath: /testdir
8587
name: test-volume

hacks/values/keto.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ deployment:
5252
extraEnv:
5353
- name: FOO
5454
value: BAR
55+
- name: RELEASE_NAME
56+
value: "{{ .Release.Name }}"
5557
extraVolumeMounts:
5658
- mountPath: /testdir
5759
name: test-volume

hacks/values/kratos.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ deployment:
234234
secretKeyRef:
235235
name: dsn-secret
236236
key: dsn
237+
- name: RELEASE_NAME
238+
value: "{{ .Release.Name }}"
237239
customLivenessProbe:
238240
failureThreshold: 5
239241
exec:

hacks/values/oathkeeper.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ deployment:
4646
image: "alpine:latest"
4747
command: ["/bin/sh"]
4848
args: ["-c", "sleep infinity"]
49+
extraEnv:
50+
- name: RELEASE_NAME
51+
value: "{{ .Release.Name }}"
4952
podMetadata:
5053
labels:
5154
ory.sh/pod_label: oathkeeper

helm/charts/hydra/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes
3636
| cronjob.janitor.customArgs | list | `[]` | Configure the arguments of the entrypoint, overriding the default value |
3737
| cronjob.janitor.customCommand | list | `[]` | Configure a custom entrypoint, overriding the default value |
3838
| cronjob.janitor.extraContainers | string | `""` | If you want to add extra sidecar containers. |
39-
| 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 |
39+
| cronjob.janitor.extraEnv | list | `[]` | Array of extra envs to be passed to the cronjob. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
4040
| cronjob.janitor.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. |
4141
| cronjob.janitor.extraVolumeMounts | list | `[]` | |
4242
| cronjob.janitor.extraVolumes | list | `[]` | If you want to mount external volume |
@@ -56,7 +56,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes
5656
| cronjob.janitor.tolerations | list | `[]` | Configure node tolerations |
5757
| deployment.annotations | object | `{}` | Set custom deployment level annotations |
5858
| deployment.automigration | object | `{"extraEnv":[]}` | Parameters for the automigration initContainer |
59-
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected - name: FOO value: BAR |
59+
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
6060
| deployment.automountServiceAccountToken | bool | `false` | |
6161
| deployment.autoscaling | object | `{"behavior":{},"enabled":false,"maxReplicas":3,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Configure HPA |
6262
| deployment.autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior |
@@ -65,7 +65,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes
6565
| deployment.customStartupProbe | object | `{}` | Configure a custom startupProbe. This overwrites the default object |
6666
| deployment.dnsConfig | object | `{}` | Configure pod dnsConfig. |
6767
| deployment.extraContainers | string | `""` | If you want to add extra sidecar containers. |
68-
| deployment.extraEnv | list | `[]` | Array of extra envs to be passed to the deployment. Kubernetes format is expected - name: FOO value: BAR |
68+
| deployment.extraEnv | list | `[]` | Array of extra envs to be passed to the deployment. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
6969
| deployment.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. |
7070
| deployment.extraVolumeMounts | list | `[]` | |
7171
| deployment.extraVolumes | list | `[]` | If you want to mount external volume |
@@ -139,7 +139,7 @@ A Helm chart for deploying ORY Hydra in Kubernetes
139139
| job.annotations | object | `{"helm.sh/hook":"pre-install, pre-upgrade","helm.sh/hook-delete-policy":"before-hook-creation","helm.sh/hook-weight":"1"}` | If you do want to specify annotations, uncomment the following lines, adjust them as necessary, and remove the curly braces after 'annotations:'. |
140140
| job.automountServiceAccountToken | bool | `true` | Set automounting of the SA token |
141141
| job.extraContainers | string | `""` | If you want to add extra sidecar containers. |
142-
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected - name: FOO value: BAR |
142+
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
143143
| job.extraInitContainers | string | `""` | If you want to add extra init containers. extraInitContainers: | - name: ... image: ... |
144144
| job.labels | object | `{}` | Set custom deployment level labels |
145145
| job.lifecycle | string | `""` | If you want to add lifecycle hooks. |

helm/charts/hydra/templates/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ spec:
154154
secretKeyRef:
155155
name: {{ include "hydra.secretname" . }}
156156
key: secretsCookie
157-
{{- with .Values.deployment.extraEnv }}
158-
{{- toYaml . | nindent 12 }}
157+
{{- if .Values.deployment.extraEnv }}
158+
{{- tpl (toYaml .Values.deployment.extraEnv) . | nindent 12 }}
159159
{{- end }}
160160
resources:
161161
{{- toYaml .Values.deployment.resources | nindent 12 }}
@@ -203,8 +203,8 @@ spec:
203203
key: dsn
204204
{{- end }}
205205
{{- end }}
206-
{{- with $migrationExtraEnv }}
207-
{{- toYaml . | nindent 12 }}
206+
{{- if $migrationExtraEnv }}
207+
{{- tpl (toYaml $migrationExtraEnv) . | nindent 12 }}
208208
{{- end }}
209209
{{- if .Values.hydra.automigration.resources }}
210210
resources:

helm/charts/hydra/values.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,16 @@ deployment:
246246
# lines, adjust them as necessary, and remove the curly braces after 'nodeSelector:'.
247247
# foo: bar
248248

249-
# -- Array of extra envs to be passed to the deployment. Kubernetes format is expected
249+
# -- Array of extra envs to be passed to the deployment. Kubernetes format is expected. Value is processed with Helm
250+
# `tpl`
250251
# - name: FOO
251252
# value: BAR
252253
extraEnv: []
253254

254255
# -- Parameters for the automigration initContainer
255256
automigration:
256-
# -- Array of extra envs to be passed to the initContainer. Kubernetes format is expected
257+
# -- Array of extra envs to be passed to the initContainer. Kubernetes format is expected. Value is processed with
258+
# Helm `tpl`
257259
# - name: FOO
258260
# value: BAR
259261
extraEnv: []
@@ -391,7 +393,8 @@ job:
391393
# - name: ...
392394
# image: ...
393395

394-
# -- Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected
396+
# -- Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format
397+
# is expected. Value is processed with Helm `tpl`
395398
# - name: FOO
396399
# value: BAR
397400
extraEnv: []
@@ -534,7 +537,8 @@ cronjob:
534537
# -- Configure the arguments of the entrypoint, overriding the default value
535538
customArgs: []
536539

537-
# -- Array of extra envs to be passed to the cronjob. This takes precedence over deployment variables. Kubernetes format is expected
540+
# -- Array of extra envs to be passed to the cronjob. This takes precedence over deployment variables. Kubernetes
541+
# format is expected. Value is processed with Helm `tpl`
538542
# - name: FOO
539543
# value: BAR
540544
extraEnv: []

helm/charts/keto/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Access Control Policies as a Server
3131
| deployment.affinity | object | `{}` | |
3232
| deployment.annotations | object | `{}` | |
3333
| deployment.automigration | object | `{"extraEnv":[]}` | Parameters for the automigration initContainer |
34-
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected - name: FOO value: BAR |
34+
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
3535
| deployment.automountServiceAccountToken | bool | `true` | |
3636
| deployment.autoscaling | object | `{"behavior":{},"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPU":{},"targetMemory":{}}` | Autoscaling for keto deployment |
3737
| deployment.autoscaling.behavior | object | `{}` | Set custom behavior https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#configurable-scaling-behavior |
@@ -40,7 +40,7 @@ Access Control Policies as a Server
4040
| deployment.customStartupProbe | object | `{}` | |
4141
| deployment.dnsConfig | object | `{}` | Configure pod dnsConfig. |
4242
| deployment.extraContainers | string | `""` | If you want to add extra sidecar containers. |
43-
| deployment.extraEnv | list | `[]` | Array of extra Envs to be added to the deployment. K8s format expected - name: FOO value: BAR |
43+
| deployment.extraEnv | list | `[]` | Array of extra Envs to be added to the deployment. Kubernetes format expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
4444
| deployment.extraInitContainers | object | `{}` | If you want to add extra init containers. These are processed before the migration init container. |
4545
| deployment.extraLabels | object | `{}` | Extra labels to be added to the deployment, and pods. K8s object format expected foo: bar my.special.label/type: value |
4646
| deployment.extraPorts | list | `[]` | Extra ports to be exposed by the main deployment |
@@ -94,7 +94,7 @@ Access Control Policies as a Server
9494
| job.annotations | object | `{"helm.sh/hook":"pre-install, pre-upgrade","helm.sh/hook-delete-policy":"before-hook-creation,hook-succeeded","helm.sh/hook-weight":"1"}` | If you do want to specify annotations, uncomment the following lines, adjust them as necessary, and remove the curly braces after 'annotations:'. |
9595
| job.automountServiceAccountToken | bool | `false` | Set automounting of the SA token |
9696
| job.extraContainers | string | `""` | If you want to add extra sidecar containers. |
97-
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected - name: FOO value: BAR |
97+
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
9898
| job.extraInitContainers | string | `""` | If you want to add extra init containers. |
9999
| job.lifecycle | string | `""` | If you want to add lifecycle hooks. |
100100
| job.nodeSelector | object | `{}` | Node labels for pod assignment. |

helm/charts/keto/templates/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ spec:
102102
key: dsn
103103
{{- end }}
104104
{{- end }}
105-
{{- with $migrationExtraEnv }}
106-
{{- toYaml . | nindent 12 }}
105+
{{- if $migrationExtraEnv }}
106+
{{- tpl (toYaml $migrationExtraEnv) . | nindent 12 }}
107107
{{- end }}
108108
{{- with .Values.keto.automigration.resources }}
109109
resources:
@@ -195,8 +195,8 @@ spec:
195195
key: dsn
196196
{{- end }}
197197
{{- end }}
198-
{{- with .Values.deployment.extraEnv }}
199-
{{- toYaml . | nindent 12 }}
198+
{{- if .Values.deployment.extraEnv }}
199+
{{- tpl (toYaml .Values.deployment.extraEnv) . | nindent 12 }}
200200
{{- end }}
201201
volumeMounts:
202202
- name: {{ include "keto.name" . }}-config-volume

helm/charts/keto/values.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ job:
8181
# - name: ...
8282
# image: ...
8383

84-
# -- Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected
84+
# -- Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format
85+
# is expected. Value is processed with Helm `tpl`
8586
# - name: FOO
8687
# value: BAR
8788
extraEnv: []
@@ -353,7 +354,7 @@ deployment:
353354
# - name: ...
354355
# image: ...
355356

356-
# -- Array of extra Envs to be added to the deployment. K8s format expected
357+
# -- Array of extra Envs to be added to the deployment. Kubernetes format expected. Value is processed with Helm `tpl`
357358
# - name: FOO
358359
# value: BAR
359360
extraEnv: []
@@ -406,7 +407,8 @@ deployment:
406407

407408
# -- Parameters for the automigration initContainer
408409
automigration:
409-
# -- Array of extra envs to be passed to the initContainer. Kubernetes format is expected
410+
# -- Array of extra envs to be passed to the initContainer. Kubernetes format is expected. Value is processed with
411+
# Helm `tpl`
410412
# - name: FOO
411413
# value: BAR
412414
extraEnv: []

helm/charts/kratos/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ A ORY Kratos Helm chart for Kubernetes
3131
| cronjob.cleanup.affinity | object | `{}` | Configure node affinity |
3232
| cronjob.cleanup.annotations | object | `{}` | Set custom cron job level annotations |
3333
| cronjob.cleanup.customArgs | list | `[]` | Configure the arguments of the entrypoint, overriding the default value |
34-
| cronjob.cleanup.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 |
34+
| cronjob.cleanup.extraEnv | list | `[]` | Array of extra envs to be passed to the cronjob. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
3535
| cronjob.cleanup.labels | object | `{}` | Set custom cron job level labels |
3636
| cronjob.cleanup.nodeSelector | object | `{}` | Configure node labels for pod assignment |
3737
| cronjob.cleanup.podMetadata | object | `{"annotations":{},"labels":{}}` | Specify pod metadata, this metadata is added directly to the pod, and not higher objects |
@@ -43,15 +43,15 @@ A ORY Kratos Helm chart for Kubernetes
4343
| deployment.affinity | object | `{}` | Configure node affinity |
4444
| deployment.annotations | object | `{}` | |
4545
| deployment.automigration | object | `{"extraEnv":[]}` | Parameters for the automigration initContainer |
46-
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected - name: FOO value: BAR |
46+
| deployment.automigration.extraEnv | list | `[]` | Array of extra envs to be passed to the initContainer. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
4747
| deployment.automountServiceAccountToken | bool | `false` | |
4848
| deployment.customLivenessProbe | object | `{}` | Configure a custom livenessProbe. This overwrites the default object |
4949
| deployment.customReadinessProbe | object | `{}` | Configure a custom readinessProbe. This overwrites the default object |
5050
| deployment.customStartupProbe | object | `{}` | Configure a custom startupProbe. This overwrites the default object |
5151
| deployment.dnsConfig | object | `{}` | Configure pod dnsConfig. |
5252
| deployment.extraArgs | list | `[]` | Array of extra arguments to be passed down to the deployment. Kubernetes args format is expected - --foo - --sqa-opt-out |
5353
| deployment.extraContainers | string | `""` | If you want to add extra sidecar containers. |
54-
| deployment.extraEnv | list | `[]` | Array of extra envs to be passed to the deployment. Kubernetes format is expected - name: FOO value: BAR |
54+
| deployment.extraEnv | list | `[]` | Array of extra envs to be passed to the deployment. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
5555
| deployment.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. |
5656
| deployment.extraVolumeMounts | list | `[]` | |
5757
| deployment.extraVolumes | list | `[]` | If you want to mount external volume For example, mount a secret containing Certificate root CA to verify database TLS connection. |
@@ -102,7 +102,7 @@ A ORY Kratos Helm chart for Kubernetes
102102
| job.annotations | object | `{"helm.sh/hook":"pre-install, pre-upgrade","helm.sh/hook-delete-policy":"before-hook-creation,hook-succeeded","helm.sh/hook-weight":"1"}` | If you do want to specify annotations, uncomment the following lines, adjust them as necessary, and remove the curly braces after 'annotations:'. |
103103
| job.automountServiceAccountToken | bool | `false` | Set automounting of the SA token |
104104
| job.extraContainers | string | `""` | If you want to add extra sidecar containers. |
105-
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected - name: FOO value: BAR |
105+
| job.extraEnv | list | `[]` | Array of extra envs to be passed to the job. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
106106
| job.extraInitContainers | string | `""` | If you want to add extra init containers. |
107107
| job.lifecycle | string | `""` | If you want to add lifecycle hooks. |
108108
| job.nodeSelector | object | `{}` | Node labels for pod assignment. |
@@ -183,7 +183,7 @@ A ORY Kratos Helm chart for Kubernetes
183183
| statefulSet.dnsConfig | object | `{}` | Configure pod dnsConfig. |
184184
| statefulSet.extraArgs | list | `[]` | Array of extra arguments to be passed down to the StatefulSet. Kubernetes args format is expected |
185185
| statefulSet.extraContainers | string | `""` | If you want to add extra sidecar containers. |
186-
| statefulSet.extraEnv | list | `[]` | |
186+
| statefulSet.extraEnv | list | `[]` | Array of extra envs to be passed to the StatefulSet. This takes precedence over deployment variables. Kubernetes format is expected. Value is processed with Helm `tpl` - name: FOO value: BAR |
187187
| statefulSet.extraInitContainers | string | `""` | If you want to add extra init containers. These are processed before the migration init container. |
188188
| statefulSet.extraVolumeMounts | list | `[]` | |
189189
| statefulSet.extraVolumes | list | `[]` | If you want to mount external volume For example, mount a secret containing Certificate root CA to verify database TLS connection. |

helm/charts/kratos/templates/cleanup-cron-job.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ spec:
7878
name: {{ include "kratos.secretname" . }}
7979
key: dsn
8080
{{- end }}
81-
{{- with $cleanupCronjobExtraEnv }}
82-
{{- toYaml . | nindent 16 }}
81+
{{- if $cleanupCronjobExtraEnv }}
82+
{{- tpl (toYaml $cleanupCronjobExtraEnv) . | nindent 16 }}
8383
{{- end }}
8484
resources:
8585
{{- toYaml .Values.cronjob.cleanup.resources | nindent 16 }}

helm/charts/kratos/templates/deployment-kratos.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ spec:
9393
{{- end }}
9494
{{- end }}
9595
{{- if $migrationExtraEnv }}
96-
{{- toYaml $migrationExtraEnv | nindent 12 }}
96+
{{- tpl (toYaml $migrationExtraEnv) . | nindent 12 }}
9797
{{- end }}
9898
{{- with .Values.kratos.automigration.resources }}
9999
resources:
@@ -194,7 +194,7 @@ spec:
194194
value: "true"
195195
{{- end }}
196196
{{- if .Values.deployment.extraEnv }}
197-
{{- toYaml .Values.deployment.extraEnv | nindent 12 }}
197+
{{- tpl (toYaml .Values.deployment.extraEnv) . | nindent 12 }}
198198
{{- end }}
199199
{{- if .Values.deployment.environmentSecretsName }}
200200
envFrom:

helm/charts/kratos/templates/job-migration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ spec:
7070
{{- end }}
7171
{{- end }}
7272
{{- if $migrationExtraEnv }}
73-
{{- toYaml $migrationExtraEnv | nindent 10 }}
73+
{{- tpl (toYaml $migrationExtraEnv) . | nindent 10 }}
7474
{{- end }}
7575
{{- if .Values.deployment.environmentSecretsName }}
7676
envFrom:

0 commit comments

Comments
 (0)