Skip to content

Commit d0e7878

Browse files
authored
Merge pull request #2901 from k8s-infra-cherrypick-robot/cherry-pick-2894-to-release-1.6
[release-1.6] Convert resourceGroup name in ID for VMSS vms to lower case to keep it compatible with the rest of capz
2 parents 02f6577 + f3cdfcd commit d0e7878

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

azure/converters/vmss.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/Azure/go-autorest/autorest/to"
2222
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
2323
"sigs.k8s.io/cluster-api-provider-azure/azure"
24+
azureutil "sigs.k8s.io/cluster-api-provider-azure/util/azure"
2425
)
2526

2627
// SDKToVMSS converts an Azure SDK VirtualMachineScaleSet to the AzureMachinePool type.
@@ -63,8 +64,15 @@ func SDKToVMSS(sdkvmss compute.VirtualMachineScaleSet, sdkinstances []compute.Vi
6364

6465
// SDKToVMSSVM converts an Azure SDK VirtualMachineScaleSetVM into an infrav1exp.VMSSVM.
6566
func SDKToVMSSVM(sdkInstance compute.VirtualMachineScaleSetVM) *azure.VMSSVM {
67+
// Convert resourceGroup Name ID ( ProviderID in capz objects )
68+
var convertedID string
69+
convertedID, err := azureutil.ConvertResourceGroupNameToLower(to.String(sdkInstance.ID))
70+
if err != nil {
71+
convertedID = to.String(sdkInstance.ID)
72+
}
73+
6674
instance := azure.VMSSVM{
67-
ID: to.String(sdkInstance.ID),
75+
ID: convertedID,
6876
InstanceID: to.String(sdkInstance.InstanceID),
6977
}
7078

0 commit comments

Comments
 (0)