Skip to content

Commit 3356920

Browse files
authored
fix webhook getting registered for GlobalInClusterIPPool (#99)
1 parent 6a46e9e commit 3356920

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

internal/controllers/infobloxippool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (r *InfobloxIPPoolReconciler) reconcile(ctx context.Context, pool *v1alpha1
188188
// determineDNSView determines the DNS view to use based on the priority order:
189189
// 1. Pool.spec.dnsView (if set)
190190
// 2. Instance.spec.defaultDnsView (if not set on pool but set on instance)
191-
// 3. Derived from networkView (if neither is set)
191+
// 3. Derived from networkView (if neither is set).
192192
func determineDNSView(poolDNSView, instanceDefaultDNSView, networkView string) string {
193193
if poolDNSView != "" {
194194
return poolDNSView

internal/webhooks/infobloxippool.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"k8s.io/apimachinery/pkg/runtime"
3030
"k8s.io/apimachinery/pkg/util/validation/field"
3131
"k8s.io/utils/ptr"
32-
"sigs.k8s.io/cluster-api-ipam-provider-in-cluster/api/v1alpha2"
3332
ctrl "sigs.k8s.io/controller-runtime"
3433
"sigs.k8s.io/controller-runtime/pkg/client"
3534
"sigs.k8s.io/controller-runtime/pkg/webhook"
@@ -44,16 +43,8 @@ const (
4443
)
4544

4645
func (webhook *InfobloxIPPool) SetupWebhookWithManager(mgr ctrl.Manager) error {
47-
err := ctrl.NewWebhookManagedBy(mgr).
48-
For(&v1alpha1.InfobloxIPPool{}).
49-
WithDefaulter(webhook).
50-
WithValidator(webhook).
51-
Complete()
52-
if err != nil {
53-
return err
54-
}
5546
return ctrl.NewWebhookManagedBy(mgr).
56-
For(&v1alpha2.GlobalInClusterIPPool{}).
47+
For(&v1alpha1.InfobloxIPPool{}).
5748
WithDefaulter(webhook).
5849
WithValidator(webhook).
5950
Complete()
@@ -135,7 +126,7 @@ func (webhook *InfobloxIPPool) validate(newPool *v1alpha1.InfobloxIPPool) (reter
135126
var allErrs field.ErrorList
136127
defer func() {
137128
if len(allErrs) > 0 {
138-
reterr = apierrors.NewInvalid(v1alpha2.GroupVersion.WithKind(newPool.GetObjectKind().GroupVersionKind().Kind).GroupKind(), newPool.GetName(), allErrs)
129+
reterr = apierrors.NewInvalid(v1alpha1.GroupVersion.WithKind(newPool.GetObjectKind().GroupVersionKind().Kind).GroupKind(), newPool.GetName(), allErrs)
139130
}
140131
}()
141132

0 commit comments

Comments
 (0)