From e44de2dcbb6fcd1dbae1a3ddb19aea3172df9357 Mon Sep 17 00:00:00 2001 From: Shafeeque E S Date: Thu, 24 Feb 2022 14:06:54 +0530 Subject: [PATCH 1/2] Add object selector for provider type --- .../application/templates/validatingwebhook-validator.yaml | 6 +++++- charts/gardener-extension-admission-gcp/values.yaml | 1 + example/40-validatingwebhookconfiguration.yaml | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/gardener-extension-admission-gcp/charts/application/templates/validatingwebhook-validator.yaml b/charts/gardener-extension-admission-gcp/charts/application/templates/validatingwebhook-validator.yaml index c46e7d771..4aac99f5c 100644 --- a/charts/gardener-extension-admission-gcp/charts/application/templates/validatingwebhook-validator.yaml +++ b/charts/gardener-extension-admission-gcp/charts/application/templates/validatingwebhook-validator.yaml @@ -17,7 +17,11 @@ webhooks: - cloudprofiles - shoots failurePolicy: Fail - objectSelector: {} + objectSelector: + {{- if .Values.global.webhookConfig.useObjectSelector }} + matchLabels: + provider.extensions.gardener.cloud/gcp: "true" + {{- end }} namespaceSelector: {} sideEffects: None admissionReviewVersions: diff --git a/charts/gardener-extension-admission-gcp/values.yaml b/charts/gardener-extension-admission-gcp/values.yaml index d1af84376..c16d45ef3 100644 --- a/charts/gardener-extension-admission-gcp/values.yaml +++ b/charts/gardener-extension-admission-gcp/values.yaml @@ -32,6 +32,7 @@ global: -----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY----- + # useObjectSelector: false # Kubeconfig to the target cluster. In-cluster configuration will be used if not specified. kubeconfig: diff --git a/example/40-validatingwebhookconfiguration.yaml b/example/40-validatingwebhookconfiguration.yaml index 7082544e3..b2241f066 100644 --- a/example/40-validatingwebhookconfiguration.yaml +++ b/example/40-validatingwebhookconfiguration.yaml @@ -17,7 +17,10 @@ webhooks: - cloudprofiles - shoots failurePolicy: Fail - objectSelector: {} + # Please make sure you are running `gardener@v1.42` or later before enabling this object selector. + objectSelector: + matchLabels: + provider.extensions.gardener.cloud/gcp: "true" namespaceSelector: {} sideEffects: None admissionReviewVersions: From 38956169e8eb75ff17865b3342955fca6d40ac12 Mon Sep 17 00:00:00 2001 From: Shafeeque E S Date: Thu, 3 Mar 2022 12:24:38 +0530 Subject: [PATCH 2/2] Add comment --- charts/gardener-extension-admission-gcp/values.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/gardener-extension-admission-gcp/values.yaml b/charts/gardener-extension-admission-gcp/values.yaml index c16d45ef3..3d4897571 100644 --- a/charts/gardener-extension-admission-gcp/values.yaml +++ b/charts/gardener-extension-admission-gcp/values.yaml @@ -32,7 +32,8 @@ global: -----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY----- - # useObjectSelector: false + # Please make sure you are running `gardener@v1.42` or later before setting this to true. + useObjectSelector: false # Kubeconfig to the target cluster. In-cluster configuration will be used if not specified. kubeconfig: