@@ -598,12 +598,14 @@ func (scaleSet *ScaleSet) DeleteNodes(nodes []*apiv1.Node) error {
598
598
if int (size ) <= scaleSet .MinSize () {
599
599
return fmt .Errorf ("min size reached, nodes will not be deleted" )
600
600
}
601
+ return scaleSet .ForceDeleteNodes (nodes )
602
+ }
601
603
602
- // Distinguish between unregistered node deletion and normal node deletion
604
+ // ForceDeleteNodes deletes nodes from the group regardless of constraints.
605
+ func (scaleSet * ScaleSet ) ForceDeleteNodes (nodes []* apiv1.Node ) error {
606
+ klog .V (8 ).Infof ("Delete nodes requested: %q\n " , nodes )
603
607
refs := make ([]* azureRef , 0 , len (nodes ))
604
608
hasUnregisteredNodes := false
605
- unregisteredRefs := make ([]* azureRef , 0 , len (nodes ))
606
-
607
609
for _ , node := range nodes {
608
610
belongs , err := scaleSet .Belongs (node )
609
611
if err != nil {
@@ -620,28 +622,12 @@ func (scaleSet *ScaleSet) DeleteNodes(nodes []*apiv1.Node) error {
620
622
ref := & azureRef {
621
623
Name : node .Spec .ProviderID ,
622
624
}
623
-
624
- if node .Annotations [cloudprovider .FakeNodeReasonAnnotation ] == cloudprovider .FakeNodeUnregistered {
625
- klog .V (5 ).Infof ("Node: %s type is unregistered..Appending to the unregistered list" , node .Name )
626
- unregisteredRefs = append (unregisteredRefs , ref )
627
- } else {
628
- refs = append (refs , ref )
629
- }
630
- }
631
-
632
- if len (unregisteredRefs ) > 0 {
633
- klog .V (3 ).Infof ("Removing unregisteredNodes: %v" , unregisteredRefs )
634
- return scaleSet .DeleteInstances (unregisteredRefs , true )
625
+ refs = append (refs , ref )
635
626
}
636
627
637
628
return scaleSet .DeleteInstances (refs , hasUnregisteredNodes )
638
629
}
639
630
640
- // ForceDeleteNodes deletes nodes from the group regardless of constraints.
641
- func (scaleSet * ScaleSet ) ForceDeleteNodes (nodes []* apiv1.Node ) error {
642
- return cloudprovider .ErrNotImplemented
643
- }
644
-
645
631
// Id returns ScaleSet id.
646
632
func (scaleSet * ScaleSet ) Id () string {
647
633
return scaleSet .Name
0 commit comments