@@ -339,6 +339,56 @@ func TestClusterProvider(t *testing.T) {
339
339
},
340
340
expected : ClusterProviderK3S ,
341
341
},
342
+ {
343
+ name : "Azure node inferred from node labels" ,
344
+ clientFunc : func () * clientgo_fake.Clientset {
345
+ return clientgo_fake .NewSimpleClientset (
346
+ & corev1.Node {
347
+ Spec : corev1.NodeSpec {
348
+ ProviderID : "azure:///subscriptions/1111111-422b-9a21-fd111111111/resourceGroups/mc_asd_asd_eucentral/providers/Microsoft.Compute/virtualMachineScaleSets/aks-nodepool1-1111-vmss/virtualMachines/0" ,
349
+ },
350
+ ObjectMeta : metav1.ObjectMeta {
351
+ Annotations : map [string ]string {
352
+ "csi.volume.kubernetes.io/nodeid" : `{"disk.csi.azure.com":"aks-nodepool1-20479306-vmss000000","file.csi.azure.com":"aks-nodepool1-20479306-vmss000000"}` ,
353
+ "node.alpha.kubernetes.io/ttl" : "0" ,
354
+ "volumes.kubernetes.io/controller-managed-attach-detach" : "true" ,
355
+ },
356
+ Labels : map [string ]string {
357
+ "agentpool" : "nodepool1" ,
358
+ "beta.kubernetes.io/arch" : "amd64" ,
359
+ "beta.kubernetes.io/instance-type" : "Standard_DS2_v2" ,
360
+ "beta.kubernetes.io/os" : "linux" ,
361
+ "failure-domain.beta.kubernetes.io/region" : "polandcentral" ,
362
+ "failure-domain.beta.kubernetes.io/zone" : "0" ,
363
+ "kubernetes.azure.com/agentpool" : "nodepool1" ,
364
+ "kubernetes.azure.com/cluster" : "MC_asd_asd_eucentral" ,
365
+ "kubernetes.azure.com/consolidated-additional-properties" : "6ea4bf17-2fb7-11ef-ac0b-fd1111111111" ,
366
+ "kubernetes.azure.com/kubelet-identity-client-id" : "42e89310-1d30-43fd-8888-fd1111111111" ,
367
+ "kubernetes.azure.com/mode" : "system" ,
368
+ "kubernetes.azure.com/node-image-version" : "AKSUbuntu-2204gen2containerd-202405.27.0" ,
369
+ "kubernetes.azure.com/nodepool-type" : "VirtualMachineScaleSets" ,
370
+ "kubernetes.azure.com/os-sku" : "Ubuntu" ,
371
+ "kubernetes.azure.com/role" : "agent" ,
372
+ "kubernetes.azure.com/storageprofile" : "managed" ,
373
+ "kubernetes.azure.com/storagetier" : "Premium_LRS" ,
374
+ "kubernetes.io/arch" : "amd64" ,
375
+ "kubernetes.io/hostname" : "aks-nodepool1-111111111-vmss000000" ,
376
+ "kubernetes.io/os" : "linux" ,
377
+ "kubernetes.io/role" : "agent" ,
378
+ "node-role.kubernetes.io/agent" : "" ,
379
+ "node.kubernetes.io/instance-type" : "Standard_DS2_v2" ,
380
+ "storageprofile" : "managed" ,
381
+ "storagetier" : "Premium_LRS" ,
382
+ "topology.disk.csi.azure.com/zone" : "" ,
383
+ "topology.kubernetes.io/region" : "polandcentral" ,
384
+ "topology.kubernetes.io/zone" : "0" ,
385
+ },
386
+ },
387
+ },
388
+ )
389
+ },
390
+ expected : ClusterProviderAzure ,
391
+ },
342
392
}
343
393
344
394
for _ , tc := range testcases {
0 commit comments