Skip to content

Commit

Permalink
fix: Fix Helm chart webhook exempt Namespace label templating (open-p…
Browse files Browse the repository at this point in the history
…olicy-agent#2090)

Fix exempt Namespace label templating

Signed-off-by: Luke Addison <lukeaddison785@gmail.com>
Signed-off-by: davis-haba <davishaba@google.com>
  • Loading branch information
dippynark authored and davis-haba committed Jul 19, 2022
1 parent d42b3c7 commit 3c0a59b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions cmd/build/helmify/replacements.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ var replacements = map[string]string{
{{- range $key, $value := .Values.mutatingWebhookExemptNamespacesLabels}}
- key: {{ $key }}
operator: NotIn
value: {{ $value }}
values:
{{- range $value }}
- {{ . }}
{{- end }}
{{- end }}`,

"HELMSUBST_MUTATING_WEBHOOK_OBJECT_SELECTOR": `{{ toYaml .Values.mutatingWebhookObjectSelector }}`,
Expand Down Expand Up @@ -95,7 +98,10 @@ var replacements = map[string]string{
{{- range $key, $value := .Values.validatingWebhookExemptNamespacesLabels}}
- key: {{ $key }}
operator: NotIn
value: {{ $value }}
values:
{{- range $value }}
- {{ . }}
{{- end }}
{{- end }}`,

"HELMSUBST_VALIDATING_WEBHOOK_OBJECT_SELECTOR": `{{ toYaml .Values.validatingWebhookObjectSelector }}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ webhooks:
{{- range $key, $value := .Values.mutatingWebhookExemptNamespacesLabels}}
- key: {{ $key }}
operator: NotIn
value: {{ $value }}
values:
{{- range $value }}
- {{ . }}
{{- end }}
{{- end }}
objectSelector: {{ toYaml .Values.mutatingWebhookObjectSelector }}
reinvocationPolicy: {{ .Values.mutatingWebhookReinvocationPolicy }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ webhooks:
{{- range $key, $value := .Values.validatingWebhookExemptNamespacesLabels}}
- key: {{ $key }}
operator: NotIn
value: {{ $value }}
values:
{{- range $value }}
- {{ . }}
{{- end }}
{{- end }}
objectSelector: {{ toYaml .Values.validatingWebhookObjectSelector }}
rules:
Expand Down

0 comments on commit 3c0a59b

Please sign in to comment.