-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: implement force delete for the azure provider #7687
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -591,12 +591,14 @@ func (scaleSet *ScaleSet) DeleteNodes(nodes []*apiv1.Node) error { | |
if int(size) <= scaleSet.MinSize() { | ||
return fmt.Errorf("min size reached, nodes will not be deleted") | ||
} | ||
return scaleSet.ForceDeleteNodes(nodes) | ||
} | ||
|
||
// Distinguish between unregistered node deletion and normal node deletion | ||
// ForceDeleteNodes deletes nodes from the group regardless of constraints. | ||
func (scaleSet *ScaleSet) ForceDeleteNodes(nodes []*apiv1.Node) error { | ||
klog.V(8).Infof("Delete nodes requested: %q\n", nodes) | ||
refs := make([]*azureRef, 0, len(nodes)) | ||
hasUnregisteredNodes := false | ||
unregisteredRefs := make([]*azureRef, 0, len(nodes)) | ||
|
||
for _, node := range nodes { | ||
belongs, err := scaleSet.Belongs(node) | ||
if err != nil { | ||
|
@@ -613,28 +615,12 @@ func (scaleSet *ScaleSet) DeleteNodes(nodes []*apiv1.Node) error { | |
ref := &azureRef{ | ||
Name: node.Spec.ProviderID, | ||
} | ||
|
||
if node.Annotations[cloudprovider.FakeNodeReasonAnnotation] == cloudprovider.FakeNodeUnregistered { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the motivation/expectation of this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clean up long unregistered nodes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that not the case before? I'm seeing it being deleted by |
||
klog.V(5).Infof("Node: %s type is unregistered..Appending to the unregistered list", node.Name) | ||
unregisteredRefs = append(unregisteredRefs, ref) | ||
} else { | ||
refs = append(refs, ref) | ||
} | ||
} | ||
|
||
if len(unregisteredRefs) > 0 { | ||
klog.V(3).Infof("Removing unregisteredNodes: %v", unregisteredRefs) | ||
return scaleSet.DeleteInstances(unregisteredRefs, true) | ||
refs = append(refs, ref) | ||
} | ||
|
||
return scaleSet.DeleteInstances(refs, hasUnregisteredNodes) | ||
} | ||
|
||
// ForceDeleteNodes deletes nodes from the group regardless of constraints. | ||
func (scaleSet *ScaleSet) ForceDeleteNodes(nodes []*apiv1.Node) error { | ||
return cloudprovider.ErrNotImplemented | ||
} | ||
|
||
// Id returns ScaleSet id. | ||
func (scaleSet *ScaleSet) Id() string { | ||
return scaleSet.Name | ||
|
Uh oh!
There was an error while loading. Please reload this page.