Skip to content

Commit 2544b33

Browse files
committed
feat: add envFrom value to deployment webhook
to allow users to pass env variables through configmaps and secrets Signed-off-by: falcorocks <[email protected]>
1 parent a8b34ab commit 2544b33

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

charts/policy-controller/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ helm uninstall [RELEASE_NAME]
172172
| webhook.configData | object | `{}` | |
173173
| webhook.customLabels | object | `{}` | |
174174
| webhook.env | object | `{}` | |
175+
| webhook.envFrom | object | `{}` | |
175176
| webhook.extraArgs | object | `{}` | |
176177
| webhook.failurePolicy | string | `"Fail"` | |
177178
| webhook.image.pullPolicy | string | `"IfNotPresent"` | |

charts/policy-controller/templates/webhook/deployment_webhook.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ spec:
7676
- name: "{{ $key }}"
7777
value: "{{ $value }}"
7878
{{- end }}
79+
{{- end }}
80+
{{- if .Values.webhook.envFrom }}
81+
envFrom:
82+
{{- range $configMapName := .Values.webhook.envFrom.configmaps }}
83+
- configMapRef:
84+
name: "{{ $configMapName }}"
85+
{{- end }}
86+
{{- range $secretName := .Values.webhook.envFrom.secrets }}
87+
- secretRef:
88+
name: "{{ $secretName }}"
89+
{{- end }}
7990
{{- end }}
8091
{{- if or (semverCompare ">= 1.8-0" .Chart.AppVersion) .Values.webhook.extraArgs }}
8192
args:

charts/policy-controller/values.schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@
206206
"title": "env",
207207
"type": "object"
208208
},
209+
"envFrom": {
210+
"required": [],
211+
"title": "envFrom",
212+
"type": "object"
213+
},
209214
"extraArgs": {
215+
"description": "configmaps:\n - mycm1\n - mycm2\nsecrets:\n - mys1\n - mys2",
210216
"required": [],
211217
"title": "extraArgs",
212218
"type": "object"

charts/policy-controller/values.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ webhook:
2323
version: sha256:6b51f336dec9e9adff29606855dbd2c7910c5eb80d6579795a29cb3844428efc
2424
pullPolicy: IfNotPresent
2525
env: {}
26+
envFrom: {}
27+
# configmaps:
28+
# - mycm1
29+
# - mycm2
30+
# secrets:
31+
# - mys1
32+
# - mys2
2633
extraArgs: {}
2734
resources:
2835
limits:

0 commit comments

Comments
 (0)