Skip to content

Commit caf5ae9

Browse files
stuggiopenshift-merge-bot[bot]
authored andcommitted
Remove deprecated webhook.Defaulter/Validator interface assertions
These compile-time assertions reference webhook.Defaulter and webhook.Validator interfaces that are removed in controller-runtime v0.21 (OCP 4.20). The assertions are dead code — webhook registration already uses CustomDefaulter/CustomValidator in internal/webhook/. Removing them makes the API module forward-compatible with CR v0.21 so that consumers (like openstack-operator) can bump controller-runtime without needing replace directives for this operator. Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent d5b65e1 commit caf5ae9

4 files changed

Lines changed: 0 additions & 20 deletions

File tree

api/v1beta1/watcher_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"k8s.io/apimachinery/pkg/util/validation/field"
2828
"k8s.io/utils/ptr"
2929
logf "sigs.k8s.io/controller-runtime/pkg/log"
30-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3130
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3231
)
3332

@@ -49,8 +48,6 @@ func SetupWatcherDefaults(defaults WatcherDefaults) {
4948
watcherlog.Info("Watcher defaults initialized", "defaults", defaults)
5049
}
5150

52-
var _ webhook.Defaulter = &Watcher{}
53-
5451
// Default implements webhook.Defaulter so a webhook will be registered for the type
5552
func (r *Watcher) Default() {
5653
watcherlog.Info("default", "name", r.Name)
@@ -108,8 +105,6 @@ func (spec *WatcherSpecCore) getDeprecatedFields(old *WatcherSpecCore) []common_
108105
return deprecatedFields
109106
}
110107

111-
var _ webhook.Validator = &Watcher{}
112-
113108
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
114109
func (r *Watcher) ValidateCreate() (admission.Warnings, error) {
115110
watcherlog.Info("validate create", "name", r.Name)

api/v1beta1/watcherapi_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/runtime"
2222
"k8s.io/apimachinery/pkg/util/validation/field"
2323
logf "sigs.k8s.io/controller-runtime/pkg/log"
24-
"sigs.k8s.io/controller-runtime/pkg/webhook"
2524
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2625
)
2726

@@ -30,8 +29,6 @@ var watcherapilog = logf.Log.WithName("watcherapi-resource")
3029

3130
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3231

33-
var _ webhook.Defaulter = &WatcherAPI{}
34-
3532
// Default implements webhook.Defaulter so a webhook will be registered for the type
3633
func (r *WatcherAPI) Default() {
3734
watcherapilog.Info("default", "name", r.Name)
@@ -41,8 +38,6 @@ func (r *WatcherAPI) Default() {
4138

4239
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
4340

44-
var _ webhook.Validator = &WatcherAPI{}
45-
4641
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
4742
func (r *WatcherAPI) ValidateCreate() (admission.Warnings, error) {
4843
watcherapilog.Info("validate create", "name", r.Name)

api/v1beta1/watcherapplier_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/runtime"
2222
"k8s.io/apimachinery/pkg/util/validation/field"
2323
logf "sigs.k8s.io/controller-runtime/pkg/log"
24-
"sigs.k8s.io/controller-runtime/pkg/webhook"
2524
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2625
)
2726

@@ -30,8 +29,6 @@ var watcherapplierlog = logf.Log.WithName("watcherapplier-resource")
3029

3130
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3231

33-
var _ webhook.Defaulter = &WatcherApplier{}
34-
3532
// Default implements webhook.Defaulter so a webhook will be registered for the type
3633
func (r *WatcherApplier) Default() {
3734
watcherapplierlog.Info("default", "name", r.Name)
@@ -41,8 +38,6 @@ func (r *WatcherApplier) Default() {
4138

4239
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
4340

44-
var _ webhook.Validator = &WatcherApplier{}
45-
4641
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
4742
func (r *WatcherApplier) ValidateCreate() (admission.Warnings, error) {
4843
watcherapplierlog.Info("validate create", "name", r.Name)

api/v1beta1/watcherdecisionengine_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"k8s.io/apimachinery/pkg/runtime"
2222
"k8s.io/apimachinery/pkg/util/validation/field"
2323
logf "sigs.k8s.io/controller-runtime/pkg/log"
24-
"sigs.k8s.io/controller-runtime/pkg/webhook"
2524
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2625
)
2726

@@ -30,8 +29,6 @@ var watcherdecisionenginelog = logf.Log.WithName("watcherdecisionengine-resource
3029

3130
// TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3231

33-
var _ webhook.Defaulter = &WatcherDecisionEngine{}
34-
3532
// Default implements webhook.Defaulter so a webhook will be registered for the type
3633
func (r *WatcherDecisionEngine) Default() {
3734
watcherdecisionenginelog.Info("default", "name", r.Name)
@@ -41,8 +38,6 @@ func (r *WatcherDecisionEngine) Default() {
4138

4239
// TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation.
4340

44-
var _ webhook.Validator = &WatcherDecisionEngine{}
45-
4641
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
4742
func (r *WatcherDecisionEngine) ValidateCreate() (admission.Warnings, error) {
4843
watcherdecisionenginelog.Info("validate create", "name", r.Name)

0 commit comments

Comments
 (0)