From a1eb17f55b2aaf9a8eb58dd20624bfcedccb3f15 Mon Sep 17 00:00:00 2001 From: Luca Bernstein Date: Thu, 21 Nov 2024 13:03:21 +0100 Subject: [PATCH] Remove the provider type predicate in the admission webhook --- pkg/admission/validator/webhook.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/admission/validator/webhook.go b/pkg/admission/validator/webhook.go index bc43e121..f7e8fd64 100644 --- a/pkg/admission/validator/webhook.go +++ b/pkg/admission/validator/webhook.go @@ -4,15 +4,14 @@ package validator import ( - extensionspredicate "github.com/gardener/gardener/extensions/pkg/predicate" extensionswebhook "github.com/gardener/gardener/extensions/pkg/webhook" "github.com/gardener/gardener/pkg/apis/core" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" - "sigs.k8s.io/controller-runtime/pkg/predicate" - ironcore "github.com/ironcore-dev/gardener-extension-provider-ironcore/pkg/ironcore" + "github.com/ironcore-dev/gardener-extension-provider-ironcore/pkg/ironcore" ) const ( @@ -29,14 +28,17 @@ func New(mgr manager.Manager) (*extensionswebhook.Webhook, error) { logger.Info("Setting up webhook", "name", Name) return extensionswebhook.New(mgr, extensionswebhook.Args{ - Provider: ironcore.Type, - Name: Name, - Path: "/webhooks/validate", - Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(ironcore.Type)}, + Provider: ironcore.Type, + Name: Name, + Path: "/webhooks/validate", Validators: map[extensionswebhook.Validator][]extensionswebhook.Type{ NewShootValidator(mgr): {{Obj: &core.Shoot{}}}, NewSecretBindingValidator(mgr): {{Obj: &core.SecretBinding{}}}, }, + Target: extensionswebhook.TargetSeed, + ObjectSelector: &metav1.LabelSelector{ + MatchLabels: map[string]string{"provider.extensions.gardener.cloud/ironcore": "true"}, + }, }) }