Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactored vultr node delete #5709

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cluster-autoscaler/cloudprovider/vultr/OWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
approvers:
#- ddymko
#- happytreees
#- optik-aper
reviewers:
#- ddymko
#- happytreees
#- optik-aper
10 changes: 5 additions & 5 deletions cluster-autoscaler/cloudprovider/vultr/vultr_node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ func (n *NodeGroup) IncreaseSize(delta int) error {
func (n *NodeGroup) DeleteNodes(nodes []*apiv1.Node) error {
for _, node := range nodes {
nodeID, ok := node.Labels[nodeIDLabel]
providerID := node.Spec.ProviderID

//todo review this
if !ok {
// CA creates fake node objects to represent upcoming VMs that
// haven't registered as nodes yet. We cannot delete the node at
// this point.
return fmt.Errorf("cannot delete node %q with provider ID %q on node pool %q: node ID label %q is missing", node.Name, node.Spec.ProviderID, n.id, nodeIDLabel)
if providerID == "" {
return fmt.Errorf("cannot delete node %q on node pool %q: missing provider ID and node ID label %q", node.Name, n.id, nodeIDLabel)
}
nodeID = toNodeID(providerID)
}

err := n.client.DeleteNodePoolInstance(context.Background(), n.clusterID, n.id, nodeID)
Expand Down