Skip to content

Commit 3eb195e

Browse files
mulpuriHarness
authored andcommitted
[fix]: [CCM-30181]: Cloudinfo - Add all available VM types to aks (#30)
* fadc4c CCM-30181: Add all available types to aks * a69505 CCM-29859: Add all available types to aks
1 parent 3c0718e commit 3eb195e

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

internal/cloudinfo/providers/azure/cloudinfo.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -526,17 +526,7 @@ func (a *AzureInfoer) GetProducts(vms []types.VMInfo, service, regionId string)
526526
}
527527
switch service {
528528
case svcAks:
529-
var virtualMachines []types.VMInfo
530-
possibleVmTypes := containerservice.PossibleVMSizeTypesValues()
531-
for _, vm := range possibleVmTypes {
532-
for _, virtualMachine := range vmList {
533-
if string(vm) == virtualMachine.Type {
534-
virtualMachines = append(virtualMachines, virtualMachine)
535-
break
536-
}
537-
}
538-
}
539-
return virtualMachines, nil
529+
return vmList, nil
540530
case "compute":
541531
return vmList, nil
542532
default:

internal/cloudinfo/providers/azure/cloudinfo_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,15 +540,18 @@ func TestAzureInfoer_GetProducts(t *testing.T) {
540540
vmSizes: &testStruct{},
541541
check: func(vms []types.VMInfo, err error) {
542542
assert.Nil(t, err, "the error should be nil")
543+
// AKS now returns all VMs dynamically fetched from Azure, not filtered by static enum
544+
// This ensures newer VM sizes like Dasv5 are included
545+
assert.Len(t, vms, 3, "aks should return all VMs")
543546
var cpus []float64
544547
var mems []float64
545548

546549
for _, vm := range vms {
547550
cpus = append(cpus, vm.Cpus)
548551
mems = append(mems, vm.Mem)
549552
}
550-
assert.ElementsMatch(t, cpus, []float64{4, 8})
551-
assert.ElementsMatch(t, mems, []float64{32, 32})
553+
assert.ElementsMatch(t, cpus, []float64{4, 8, 2})
554+
assert.ElementsMatch(t, mems, []float64{32, 32, 5})
552555
},
553556
},
554557
{

0 commit comments

Comments
 (0)