From 7e5410533ade50394049c6c6141cca5a497817fc Mon Sep 17 00:00:00 2001 From: Luca Bernstein Date: Mon, 4 Nov 2024 13:03:34 +0100 Subject: [PATCH] Remove the provider type predicates in webhooks --- pkg/admission/mutator/webhook.go | 9 +++------ pkg/admission/validator/webhook.go | 5 ----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/pkg/admission/mutator/webhook.go b/pkg/admission/mutator/webhook.go index f5d3455be..ce9dd7448 100644 --- a/pkg/admission/mutator/webhook.go +++ b/pkg/admission/mutator/webhook.go @@ -5,13 +5,11 @@ package mutator import ( - extensionspredicate "github.com/gardener/gardener/extensions/pkg/predicate" extensionswebhook "github.com/gardener/gardener/extensions/pkg/webhook" gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1" 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" "github.com/gardener/gardener-extension-provider-aws/pkg/aws" ) @@ -28,10 +26,9 @@ func New(mgr manager.Manager) (*extensionswebhook.Webhook, error) { logger.Info("Setting up webhook", "name", Name) return extensionswebhook.New(mgr, extensionswebhook.Args{ - Provider: aws.Type, - Name: Name, - Path: "/webhooks/mutate", - Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(aws.Type)}, + Provider: aws.Type, + Name: Name, + Path: "/webhooks/mutate", Mutators: map[extensionswebhook.Mutator][]extensionswebhook.Type{ NewShootMutator(mgr): {{Obj: &gardencorev1beta1.Shoot{}}}, }, diff --git a/pkg/admission/validator/webhook.go b/pkg/admission/validator/webhook.go index af0fec9e7..212b70972 100644 --- a/pkg/admission/validator/webhook.go +++ b/pkg/admission/validator/webhook.go @@ -5,7 +5,6 @@ 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/security" @@ -13,7 +12,6 @@ import ( 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" "github.com/gardener/gardener-extension-provider-aws/pkg/aws" ) @@ -35,9 +33,6 @@ func New(mgr manager.Manager) (*extensionswebhook.Webhook, error) { Provider: aws.Type, Name: Name, Path: "/webhooks/validate", - // TODO(dimityrmirchev): Uncomment this line once this extension uses a g/g version that contains https://github.com/gardener/gardener/pull/10499 - // Predicates: []predicate.Predicate{predicate.Or(extensionspredicate.GardenCoreProviderType(aws.Type), extensionspredicate.GardenSecurityProviderType(aws.Type))}, - Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(aws.Type)}, Validators: map[extensionswebhook.Validator][]extensionswebhook.Type{ NewShootValidator(mgr): {{Obj: &core.Shoot{}}}, NewCloudProfileValidator(mgr): {{Obj: &core.CloudProfile{}}},