Skip to content

Commit

Permalink
azure: skip non azure nodes
Browse files Browse the repository at this point in the history
Skip non azure providerID to support on-premise kubernetes nodes.
  • Loading branch information
sergelogvinov committed Nov 16, 2023
1 parent 82f85c2 commit c5c6356
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package azure
import (
"io"
"os"
"strings"

apiv1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c5c6356

Please sign in to comment.