Skip to content

Commit

Permalink
Remove the provider type predicates in webhooks
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaBernstein committed Oct 31, 2024
1 parent e73fff3 commit 5ed88fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 3 additions & 6 deletions pkg/admission/mutator/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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-azure/pkg/azure"
)
Expand All @@ -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: azure.Type,
Name: Name,
Path: "/webhooks/mutate",
Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(azure.Type)},
Provider: azure.Type,
Name: Name,
Path: "/webhooks/mutate",
Mutators: map[extensionswebhook.Mutator][]extensionswebhook.Type{
NewShootMutator(mgr): {{Obj: &gardencorev1beta1.Shoot{}}},
},
Expand Down
5 changes: 0 additions & 5 deletions pkg/admission/validator/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
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"
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"

"github.com/gardener/gardener-extension-provider-azure/pkg/azure"
)
Expand All @@ -35,9 +33,6 @@ func New(mgr manager.Manager) (*extensionswebhook.Webhook, error) {
Provider: azure.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(azure.Type), extensionspredicate.GardenSecurityProviderType(azure.Type))},
Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(azure.Type)},
Validators: map[extensionswebhook.Validator][]extensionswebhook.Type{
NewShootValidator(mgr): {{Obj: &core.Shoot{}}},
NewCloudProfileValidator(mgr): {{Obj: &core.CloudProfile{}}},
Expand Down

0 comments on commit 5ed88fd

Please sign in to comment.