Skip to content

Commit e3c6f86

Browse files
committed
Fix for webhook validation of AzureManagedControlPlane VNET Resource Groups
1 parent 5f44feb commit e3c6f86

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api/v1beta1/azuremanagedcontrolplane_webhook.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,10 @@ func (m *AzureManagedControlPlane) validateVirtualNetworkUpdate(old *AzureManage
719719
"Subnet CIDRBlock is immutable"))
720720
}
721721

722-
if old.Spec.VirtualNetwork.ResourceGroup != m.Spec.VirtualNetwork.ResourceGroup {
722+
// For old palette clusters (created with CAPZ v1.3.2), the resource group of VirtualNetwork would be empty for dynamic AKS clusters.
723+
// The new CAPZ (v1.18.0 as of now), adds the resource group to the AzureManagedControlPlane's VirtualNetwork spec by default.
724+
// Hence, a validation is added here (for empty string check) which allows the old clusters to upgrade.
725+
if old.Spec.VirtualNetwork.ResourceGroup != "" && old.Spec.VirtualNetwork.ResourceGroup != m.Spec.VirtualNetwork.ResourceGroup {
723726
allErrs = append(allErrs,
724727
field.Invalid(
725728
field.NewPath("spec", "virtualNetwork", "resourceGroup"),

0 commit comments

Comments
 (0)