Skip to content

Commit a7f38e2

Browse files
committed
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 c5bd1cd commit a7f38e2

4 files changed

Lines changed: 0 additions & 11 deletions

File tree

api/go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ require (
2121
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2222
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
2323
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
24-
github.com/fsnotify/fsnotify v1.7.0 // indirect
2524
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
2625
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
2726
github.com/go-openapi/jsonpointer v0.21.0 // indirect

api/go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lSh
1414
github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
1515
github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=
1616
github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ=
17-
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
18-
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
1917
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
2018
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
2119
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=

api/v1beta1/openstackbaremetalset_webhook.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
"k8s.io/apimachinery/pkg/util/validation/field"
3636
goClient "sigs.k8s.io/controller-runtime/pkg/client"
3737
logf "sigs.k8s.io/controller-runtime/pkg/log"
38-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3938
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
4039
)
4140

@@ -52,8 +51,6 @@ func SetupWebhookClient(client goClient.Client) {
5251
// log is for logging in this package.
5352
var openstackbaremetalsetlog = logf.Log.WithName("openstackbaremetalset-resource")
5453

55-
var _ webhook.Validator = &OpenStackBaremetalSet{}
56-
5754
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
5855
func (r *OpenStackBaremetalSet) ValidateCreate() (admission.Warnings, error) {
5956
openstackbaremetalsetlog.Info("validate create", "name", r.Name)

api/v1beta1/openstackprovisionserver_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"k8s.io/apimachinery/pkg/types"
3131
"k8s.io/apimachinery/pkg/util/validation/field"
3232
logf "sigs.k8s.io/controller-runtime/pkg/log"
33-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3433
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3534
)
3635

@@ -45,8 +44,6 @@ func SetupOpenStackProvisionServerDefaults(defaults OpenStackProvisionServerDefa
4544
openstackprovisionserverlog.Info("OpenStackProvisionServer defaults initialized", "defaults", defaults)
4645
}
4746

48-
var _ webhook.Validator = &OpenStackProvisionServer{}
49-
5047
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
5148
func (r *OpenStackProvisionServer) ValidateCreate() (admission.Warnings, error) {
5249
openstackprovisionserverlog.Info("validate create", "name", r.Name)
@@ -98,8 +95,6 @@ func (r *OpenStackProvisionServer) ValidateDelete() (admission.Warnings, error)
9895
return nil, nil
9996
}
10097

101-
var _ webhook.Defaulter = &OpenStackProvisionServer{}
102-
10398
// Default implements webhook.Defaulter so a webhook will be registered for the type
10499
func (r *OpenStackProvisionServer) Default() {
105100
openstackprovisionserverlog.Info("default", "name", r.Name)

0 commit comments

Comments
 (0)