Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the provider type predicates in webhooks #895

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-openstack/pkg/openstack"
)
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: openstack.Type,
Name: Name,
Path: "/webhooks/mutate",
Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(openstack.Type)},
Provider: openstack.Type,
Name: Name,
Path: "/webhooks/mutate",
Mutators: map[extensionswebhook.Mutator][]extensionswebhook.Type{
NewShootMutator(mgr): {{Obj: &gardencorev1beta1.Shoot{}}},
},
Expand Down
17 changes: 6 additions & 11 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-openstack/pkg/openstack"
)
Expand All @@ -32,16 +30,13 @@ func New(mgr manager.Manager) (*extensionswebhook.Webhook, error) {
logger.Info("Setting up webhook", "name", Name)

return extensionswebhook.New(mgr, extensionswebhook.Args{
Provider: openstack.Type,
Name: Name,
Path: "/webhooks/validate",
Predicates: []predicate.Predicate{extensionspredicate.GardenCoreProviderType(openstack.Type)},
Provider: openstack.Type,
Name: Name,
Path: "/webhooks/validate",
Validators: map[extensionswebhook.Validator][]extensionswebhook.Type{
NewShootValidator(mgr): {{Obj: &core.Shoot{}}},
NewCloudProfileValidator(mgr): {{Obj: &core.CloudProfile{}}},
NewSecretBindingValidator(mgr): {{Obj: &core.SecretBinding{}}},
// 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(openstack.Type), extensionspredicate.GardenSecurityProviderType(openstack.Type))},
NewShootValidator(mgr): {{Obj: &core.Shoot{}}},
NewCloudProfileValidator(mgr): {{Obj: &core.CloudProfile{}}},
NewSecretBindingValidator(mgr): {{Obj: &core.SecretBinding{}}},
NewCredentialsBindingValidator(mgr): {{Obj: &security.CredentialsBinding{}}},
},
Target: extensionswebhook.TargetSeed,
Expand Down
Loading