diff --git a/pkg/admission/validator/webhook.go b/pkg/admission/validator/webhook.go index bc43e121..a28ce738 100644 --- a/pkg/admission/validator/webhook.go +++ b/pkg/admission/validator/webhook.go @@ -4,15 +4,15 @@ 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" + "github.com/gardener/gardener/pkg/apis/core/v1beta1/constants" 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 +29,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{constants.LabelExtensionProviderTypePrefix + ironcore.Type: "true"}, + }, }) }