Skip to content

Commit 95a4f34

Browse files
committed
Set DefaulterRemoveUnknownOrOmitableFields webhook option to preserve previous behavior
1 parent 12b93e6 commit 95a4f34

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

internal/webhooks/vmware/vspheremachine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (webhook *VSphereMachineWebhook) SetupWebhookWithManager(mgr ctrl.Manager)
4545
return ctrl.NewWebhookManagedBy(mgr).
4646
For(&vmwarev1.VSphereMachine{}).
4747
WithValidator(webhook).
48-
WithDefaulter(webhook).
48+
WithDefaulter(webhook, admission.DefaulterRemoveUnknownOrOmitableFields).
4949
Complete()
5050
}
5151

internal/webhooks/vspheredeploymentzone.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"k8s.io/utils/ptr"
2626
ctrl "sigs.k8s.io/controller-runtime"
2727
"sigs.k8s.io/controller-runtime/pkg/webhook"
28+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2829

2930
infrav1 "sigs.k8s.io/cluster-api-provider-vsphere/apis/v1beta1"
3031
)
@@ -39,7 +40,7 @@ var _ webhook.CustomDefaulter = &VSphereDeploymentZoneWebhook{}
3940
func (webhook *VSphereDeploymentZoneWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error {
4041
return ctrl.NewWebhookManagedBy(mgr).
4142
For(&infrav1.VSphereDeploymentZone{}).
42-
WithDefaulter(webhook).
43+
WithDefaulter(webhook, admission.DefaulterRemoveUnknownOrOmitableFields).
4344
Complete()
4445
}
4546

internal/webhooks/vspherefailuredomain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (webhook *VSphereFailureDomainWebhook) SetupWebhookWithManager(mgr ctrl.Man
4545
return ctrl.NewWebhookManagedBy(mgr).
4646
For(&infrav1.VSphereFailureDomain{}).
4747
WithValidator(webhook).
48-
WithDefaulter(webhook).
48+
WithDefaulter(webhook, admission.DefaulterRemoveUnknownOrOmitableFields).
4949
Complete()
5050
}
5151

internal/webhooks/vspheremachine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (webhook *VSphereMachineWebhook) SetupWebhookWithManager(mgr ctrl.Manager)
4646
return ctrl.NewWebhookManagedBy(mgr).
4747
For(&infrav1.VSphereMachine{}).
4848
WithValidator(webhook).
49-
WithDefaulter(webhook).
49+
WithDefaulter(webhook, admission.DefaulterRemoveUnknownOrOmitableFields).
5050
Complete()
5151
}
5252

internal/webhooks/vspherevm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (webhook *VSphereVMWebhook) SetupWebhookWithManager(mgr ctrl.Manager) error
4646
return ctrl.NewWebhookManagedBy(mgr).
4747
For(&infrav1.VSphereVM{}).
4848
WithValidator(webhook).
49-
WithDefaulter(webhook).
49+
WithDefaulter(webhook, admission.DefaulterRemoveUnknownOrOmitableFields).
5050
Complete()
5151
}
5252

0 commit comments

Comments
 (0)