mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: add conversion function in Helm template (#11651)
* fix: add conversion function in Helm template Signed-off-by: ShutingZhao <shuting@nirmata.com> * fix: retain object as is Signed-off-by: ShutingZhao <shuting@nirmata.com> * fix: json format Signed-off-by: ShutingZhao <shuting@nirmata.com> * fix: code-gen Signed-off-by: ShutingZhao <shuting@nirmata.com> --------- Signed-off-by: ShutingZhao <shuting@nirmata.com>
This commit is contained in:
parent
cf5a5b12ae
commit
70b666e53c
2 changed files with 22 additions and 7 deletions
|
@ -56,12 +56,27 @@
|
|||
|
||||
{{- define "kyverno.config.webhooks" -}}
|
||||
{{- $excludeDefault := dict "key" "kubernetes.io/metadata.name" "operator" "NotIn" "values" (list (include "kyverno.namespace" .)) }}
|
||||
{{- $webhook := .Values.config.webhooks }}
|
||||
{{- $namespaceSelector := default dict $webhook.namespaceSelector }}
|
||||
{{- $matchExpressions := default list $namespaceSelector.matchExpressions }}
|
||||
{{- $newNamespaceSelector := dict "matchLabels" $namespaceSelector.matchLabels "matchExpressions" (append $matchExpressions $excludeDefault) }}
|
||||
{{- $newWebhook := merge (omit $webhook "namespaceSelector") (dict "namespaceSelector" $newNamespaceSelector) }}
|
||||
{{- $newWebhook | toJson }}
|
||||
{{- $webhooks := .Values.config.webhooks -}}
|
||||
{{- if $webhooks | typeIs "slice" -}}
|
||||
{{- $newWebhooks := dict -}}
|
||||
{{- range $index, $webhook := $webhooks -}}
|
||||
{{- if $webhook.namespaceSelector -}}
|
||||
{{- $namespaceSelector := $webhook.namespaceSelector }}
|
||||
{{- $matchExpressions := default (list) $namespaceSelector.matchExpressions }}
|
||||
{{- $newNamespaceSelector := dict "matchLabels" $namespaceSelector.matchLabels "matchExpressions" (append $matchExpressions $excludeDefault) }}
|
||||
{{- $newWebhook := merge (omit $webhook "namespaceSelector") (dict "namespaceSelector" $newNamespaceSelector) }}
|
||||
{{- $newWebhooks = merge $newWebhooks (dict $webhook.name $newWebhook) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $newWebhooks | toJson | nindent 2 }}
|
||||
{{- else -}}
|
||||
{{- $webhook := $webhooks }}
|
||||
{{- $namespaceSelector := default (dict) $webhook.namespaceSelector }}
|
||||
{{- $matchExpressions := default (list) $namespaceSelector.matchExpressions }}
|
||||
{{- $newNamespaceSelector := dict "matchLabels" $namespaceSelector.matchLabels "matchExpressions" (append $matchExpressions $excludeDefault) }}
|
||||
{{- $newWebhook := merge (omit $webhook "namespaceSelector") (dict "namespaceSelector" $newNamespaceSelector) }}
|
||||
{{- $newWebhook | toJson | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.config.imagePullSecret" -}}
|
||||
|
|
|
@ -175,7 +175,7 @@ data:
|
|||
[Secret,kyverno,kyverno-svc.kyverno.svc.*]
|
||||
[Secret,kyverno,kyverno-cleanup-controller.kyverno.svc.*]
|
||||
updateRequestThreshold: "1000"
|
||||
webhooks: "{\"namespaceSelector\":{\"matchExpressions\":[{\"key\":\"kubernetes.io/metadata.name\",\"operator\":\"NotIn\",\"values\":[\"kube-system\"]},{\"key\":\"kubernetes.io/metadata.name\",\"operator\":\"NotIn\",\"values\":[\"kyverno\"]}],\"matchLabels\":null}}"
|
||||
webhooks: "\n {\"namespaceSelector\":{\"matchExpressions\":[{\"key\":\"kubernetes.io/metadata.name\",\"operator\":\"NotIn\",\"values\":[\"kube-system\"]},{\"key\":\"kubernetes.io/metadata.name\",\"operator\":\"NotIn\",\"values\":[\"kyverno\"]}],\"matchLabels\":null}}"
|
||||
webhookAnnotations: "{\"admissions.enforcer/disabled\":\"true\"}"
|
||||
---
|
||||
apiVersion: v1
|
||||
|
|
Loading…
Reference in a new issue