Skip to content

Commit d9c0ed8

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 1f2407a commit d9c0ed8

4 files changed

Lines changed: 0 additions & 20 deletions

File tree

api/v1beta1/ansibletest_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,19 @@ import (
2828
"k8s.io/apimachinery/pkg/runtime"
2929
"k8s.io/apimachinery/pkg/util/validation/field"
3030
logf "sigs.k8s.io/controller-runtime/pkg/log"
31-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3231
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3332
)
3433

3534
// log is for logging in this package.
3635
var ansibletestlog = logf.Log.WithName("ansibletest-resource")
3736

38-
var _ webhook.Defaulter = &AnsibleTest{}
39-
4037
// Default implements webhook.Defaulter so a webhook will be registered for the type
4138
func (r *AnsibleTest) Default() {
4239
ansibletestlog.Info("default", "name", r.Name)
4340

4441
// TODO(user): fill in your defaulting logic.
4542
}
4643

47-
var _ webhook.Validator = &AnsibleTest{}
48-
4944
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
5045
func (r *AnsibleTest) ValidateCreate() (admission.Warnings, error) {
5146
ansibletestlog.Info("validate create", "name", r.Name)

api/v1beta1/horizontest_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,19 @@ import (
2727

2828
"k8s.io/apimachinery/pkg/runtime"
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

3433
// log is for logging in this package.
3534
var horizontestlog = logf.Log.WithName("horizontest-resource")
3635

37-
var _ webhook.Defaulter = &HorizonTest{}
38-
3936
// Default implements webhook.Defaulter so a webhook will be registered for the type
4037
func (r *HorizonTest) Default() {
4138
horizontestlog.Info("default", "name", r.Name)
4239

4340
// TODO(user): fill in your defaulting logic.
4441
}
4542

46-
var _ webhook.Validator = &HorizonTest{}
47-
4843
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
4944
func (r *HorizonTest) ValidateCreate() (admission.Warnings, error) {
5045
horizontestlog.Info("validate create", "name", r.Name)

api/v1beta1/tempest_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@ import (
2929
"k8s.io/apimachinery/pkg/runtime"
3030
"k8s.io/apimachinery/pkg/util/validation/field"
3131
logf "sigs.k8s.io/controller-runtime/pkg/log"
32-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3332
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3433
)
3534

3635
// log is for logging in this package.
3736
var tempestlog = logf.Log.WithName("tempest-resource")
3837

39-
var _ webhook.Defaulter = &Tempest{}
40-
4138
// Default implements webhook.Defaulter so a webhook will be registered for the type
4239
func (r *Tempest) Default() {
4340
tempestlog.Info("default", "name", r.Name)
@@ -60,8 +57,6 @@ func (r *Tempest) PrivilegedRequired() bool {
6057
return len(r.Spec.TempestRun.ExtraImages) > 0
6158
}
6259

63-
var _ webhook.Validator = &Tempest{}
64-
6560
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
6661
func (r *Tempest) ValidateCreate() (admission.Warnings, error) {
6762
tempestlog.Info("validate create", "name", r.Name)

api/v1beta1/tobiko_webhook.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,19 @@ import (
2929
"k8s.io/apimachinery/pkg/runtime"
3030
"k8s.io/apimachinery/pkg/util/validation/field"
3131
logf "sigs.k8s.io/controller-runtime/pkg/log"
32-
"sigs.k8s.io/controller-runtime/pkg/webhook"
3332
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
3433
)
3534

3635
// log is for logging in this package.
3736
var tobikolog = logf.Log.WithName("tobiko-resource")
3837

39-
var _ webhook.Defaulter = &Tobiko{}
40-
4138
// Default implements webhook.Defaulter so a webhook will be registered for the type
4239
func (r *Tobiko) Default() {
4340
tobikolog.Info("default", "name", r.Name)
4441

4542
// TODO(user): fill in your defaulting logic.
4643
}
4744

48-
var _ webhook.Validator = &Tobiko{}
49-
5045
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
5146
func (r *Tobiko) ValidateCreate() (admission.Warnings, error) {
5247
tobikolog.Info("validate create", "name", r.Name)

0 commit comments

Comments
 (0)