Merge pull request #8379 from dsafdsa1/csr-scaleup-time

Add NodeGroupScaleUpTime() to CSR
This commit is contained in:
Kubernetes Prow Robot 2025-08-20 05:47:09 -07:00 committed by GitHub
commit ea6e29eb54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -204,6 +204,16 @@ func (csr *ClusterStateRegistry) MaxNodeProvisionTime(nodeGroup cloudprovider.No
return csr.nodeGroupConfigProcessor.GetMaxNodeProvisionTime(nodeGroup)
}
// NodeGroupScaleUpTime returns the start time of the most recent scale-up request for the given node group.
func (csr *ClusterStateRegistry) NodeGroupScaleUpTime(nodeGroup cloudprovider.NodeGroup) (time.Time, error) {
// NOTE: Don't remove. This is used by providers who import CA as a framework/library.
scaleUpRequest, found := csr.scaleUpRequests[nodeGroup.Id()]
if !found {
return time.Time{}, fmt.Errorf("failed to find scaleUpRequest for node group: %s", nodeGroup.Id())
}
return scaleUpRequest.Time, nil
}
func (csr *ClusterStateRegistry) registerOrUpdateScaleUpNoLock(nodeGroup cloudprovider.NodeGroup, delta int, currentTime time.Time) {
maxNodeProvisionTime, err := csr.MaxNodeProvisionTime(nodeGroup)
if err != nil {