diff --git a/cluster-autoscaler/cloudprovider/azure/azure_cloud_provider.go b/cluster-autoscaler/cloudprovider/azure/azure_cloud_provider.go index 98b0ed185da3..744873284e6d 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_cloud_provider.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_cloud_provider.go @@ -19,6 +19,7 @@ package azure import ( "io" "os" + "strings" apiv1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" @@ -105,6 +106,12 @@ func (azure *AzureCloudProvider) NodeGroupForNode(node *apiv1.Node) (cloudprovid klog.V(6).Infof("Skipping the search for node group for the node '%s' because it has no spec.ProviderID", node.ObjectMeta.Name) return nil, nil } + + if !strings.HasPrefix(node.Spec.ProviderID, "azure://") { + klog.V(6).Infof("Wrong azure ProviderID for node %v, skipped", node.Name) + return nil, nil + } + klog.V(6).Infof("Searching for node group for the node: %s\n", node.Spec.ProviderID) ref := &azureRef{ Name: node.Spec.ProviderID,