Skip to content

Commit ea6e29e

Browse files
authored
Merge pull request #8379 from dsafdsa1/csr-scaleup-time
Add NodeGroupScaleUpTime() to CSR
2 parents 2e528f9 + a21cd06 commit ea6e29e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cluster-autoscaler/clusterstate/clusterstate.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,16 @@ func (csr *ClusterStateRegistry) MaxNodeProvisionTime(nodeGroup cloudprovider.No
204204
return csr.nodeGroupConfigProcessor.GetMaxNodeProvisionTime(nodeGroup)
205205
}
206206

207+
// NodeGroupScaleUpTime returns the start time of the most recent scale-up request for the given node group.
208+
func (csr *ClusterStateRegistry) NodeGroupScaleUpTime(nodeGroup cloudprovider.NodeGroup) (time.Time, error) {
209+
// NOTE: Don't remove. This is used by providers who import CA as a framework/library.
210+
scaleUpRequest, found := csr.scaleUpRequests[nodeGroup.Id()]
211+
if !found {
212+
return time.Time{}, fmt.Errorf("failed to find scaleUpRequest for node group: %s", nodeGroup.Id())
213+
}
214+
return scaleUpRequest.Time, nil
215+
}
216+
207217
func (csr *ClusterStateRegistry) registerOrUpdateScaleUpNoLock(nodeGroup cloudprovider.NodeGroup, delta int, currentTime time.Time) {
208218
maxNodeProvisionTime, err := csr.MaxNodeProvisionTime(nodeGroup)
209219
if err != nil {

0 commit comments

Comments
 (0)