Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSR: fix a bug in GetClusterSize #2546

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

towca
Copy link
Collaborator

@towca towca commented Nov 19, 2019

Currently, GetClusterSize reports the target number for all autoscaled
node groups, but the actual number for all node groups, even those
that are not autoscaled. This commit fixes that behavior so that both
target and actual size reported are from autoscaled node groups only.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 19, 2019
@towca
Copy link
Collaborator Author

towca commented Nov 19, 2019

/cc @losipiuk

@losipiuk
Copy link
Contributor

Looks reasonable but please confirm with someone else if we are not breaking some undocumented corner case with this change.

@losipiuk
Copy link
Contributor

@@ -988,7 +988,9 @@ func (csr *ClusterStateRegistry) GetClusterSize() (currentSize, targetSize int)
for _, accRange := range csr.acceptableRanges {
targetSize += accRange.CurrentTarget
}
currentSize = csr.totalReadiness.Registered - csr.totalReadiness.NotStarted - csr.totalReadiness.LongNotStarted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update the comment above to clarify this method only returns current and target number of nodes in autoscaled node groups.

While I don't particularly like long names, it also feels like this method's name could better reflect what it's doing - e.g. GetAutoscaledNodesCount?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Currently, GetClusterSize reports the target number for all autoscaled
node groups, but the actual number for _all_ node groups, even those
that are not autoscaled. This commit fixes that behavior so that both
target and actual size reported are from autoscaled node groups only.
@towca towca force-pushed the jtuznik/get-cluster-size-fix branch from 425da26 to f64b6cd Compare November 20, 2019 12:50
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 20, 2019
@aleksandra-malinowska
Copy link
Contributor

/lgtm
/approve

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 20, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aleksandra-malinowska

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2019
@k8s-ci-robot k8s-ci-robot merged commit a56fe5d into kubernetes:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants