Skip to content

Commit

Permalink
provisioner-azure: Use API to label nodes
Browse files Browse the repository at this point in the history
Fixes #1183

Signed-off-by: Suraj Deshmukh <suraj.deshmukh@microsoft.com>
  • Loading branch information
surajssd authored and kartikjoshi21 committed Jul 18, 2023
1 parent f61c377 commit 521d8d0
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions test/provisioner/provision_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"path"
"time"

Expand Down Expand Up @@ -235,6 +234,7 @@ func (p *AzureCloudProvisioner) CreateCluster(ctx context.Context, cfg *envconf.
OSType: to.Ptr(armcontainerservice.OSType(AzureProps.OsType)),
EnableNodePublicIP: to.Ptr(false),
VnetSubnetID: &AzureProps.SubnetID,
NodeLabels: map[string]*string{"node.kubernetes.io/worker": to.Ptr("")},
},
},
ServicePrincipalProfile: &armcontainerservice.ManagedClusterServicePrincipalProfile{
Expand Down Expand Up @@ -305,16 +305,6 @@ func (p *AzureCloudProvisioner) CreateCluster(ctx context.Context, cfg *envconf.

cfg.WithKubeconfigFile(kubeconfigPath)

// Update this to use label while provisioning cluster
cmd := exec.Command("kubectl", "label", "nodes", "--all", fmt.Sprintf("%s=%s", "node.kubernetes.io/worker", ""))
cmd.Env = append(cmd.Env, fmt.Sprintf("KUBECONFIG="+kubeconfigPath))

_, err = cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("labeling nodes: %w", err)
}
log.Info("Nodes labeled successfully.")

return nil
}

Expand Down

0 comments on commit 521d8d0

Please sign in to comment.