Skip to content

Commit cc3f091

Browse files
authored
cas: remove unused simulator removal funcs (#8473)
* cas: remove unused simulator removal funcs * remove ScaleDownFindNodesToRemove const * remove unreferenced ScaleDownMiscOperations
1 parent c348a2a commit cc3f091

File tree

3 files changed

+0
-310
lines changed

3 files changed

+0
-310
lines changed

cluster-autoscaler/metrics/metrics.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ const (
100100
const (
101101
ScaleDown FunctionLabel = "scaleDown"
102102
ScaleDownNodeDeletion FunctionLabel = "scaleDown:nodeDeletion"
103-
ScaleDownFindNodesToRemove FunctionLabel = "scaleDown:findNodesToRemove"
104-
ScaleDownMiscOperations FunctionLabel = "scaleDown:miscOperations"
105103
ScaleDownSoftTaintUnneeded FunctionLabel = "scaleDown:softTaintUnneeded"
106104
ScaleUp FunctionLabel = "scaleUp"
107105
BuildPodEquivalenceGroups FunctionLabel = "scaleUp:buildPodEquivalenceGroups"

cluster-autoscaler/simulator/cluster.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
199158
func (r *RemovalSimulator) withForkedSnapshot(f func() error) (err error) {
200159
r.clusterSnapshot.Fork()
201160
defer func() {

cluster-autoscaler/simulator/cluster_test.go

Lines changed: 0 additions & 267 deletions
This file was deleted.

0 commit comments

Comments
 (0)