@@ -115,29 +115,6 @@ func NewRemovalSimulator(listers kube_util.ListerRegistry, clusterSnapshot clust
115115 }
116116}
117117
118- // FindNodesToRemove finds nodes that can be removed.
119- func (r * RemovalSimulator ) FindNodesToRemove (
120- candidates []string ,
121- destinations []string ,
122- timestamp time.Time ,
123- remainingPdbTracker pdb.RemainingPdbTracker ,
124- ) (nodesToRemove []NodeToBeRemoved , unremovableNodes []* UnremovableNode ) {
125- destinationMap := make (map [string ]bool , len (destinations ))
126- for _ , destination := range destinations {
127- destinationMap [destination ] = true
128- }
129-
130- for _ , nodeName := range candidates {
131- rn , urn := r .SimulateNodeRemoval (nodeName , destinationMap , timestamp , remainingPdbTracker )
132- if rn != nil {
133- nodesToRemove = append (nodesToRemove , * rn )
134- } else if urn != nil {
135- unremovableNodes = append (unremovableNodes , urn )
136- }
137- }
138- return nodesToRemove , unremovableNodes
139- }
140-
141118// SimulateNodeRemoval simulates removing a node from the cluster to check
142119// whether it is possible to move its pods. Depending on
143120// the outcome, exactly one of (NodeToBeRemoved, UnremovableNode) will be
@@ -178,24 +155,6 @@ func (r *RemovalSimulator) SimulateNodeRemoval(
178155 }, nil
179156}
180157
181- // FindEmptyNodesToRemove finds empty nodes that can be removed.
182- func (r * RemovalSimulator ) FindEmptyNodesToRemove (candidates []string , timestamp time.Time ) []string {
183- result := make ([]string , 0 )
184- for _ , node := range candidates {
185- nodeInfo , err := r .clusterSnapshot .GetNodeInfo (node )
186- if err != nil {
187- klog .Errorf ("Can't retrieve node %s from snapshot, err: %v" , node , err )
188- continue
189- }
190- // Should block on all pods
191- podsToRemove , _ , _ , err := GetPodsToMove (nodeInfo , r .deleteOptions , r .drainabilityRules , nil , nil , timestamp )
192- if err == nil && len (podsToRemove ) == 0 {
193- result = append (result , node )
194- }
195- }
196- return result
197- }
198-
199158func (r * RemovalSimulator ) withForkedSnapshot (f func () error ) (err error ) {
200159 r .clusterSnapshot .Fork ()
201160 defer func () {
0 commit comments