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

🐛 Fix to enable Cluster Autoscaler with Replicas field set in a Classy Cluster #7708

Closed
wants to merge 1 commit into from

Conversation

abhijit-dev82
Copy link
Contributor

What this PR does / why we need it:
For classy cluster if replica field set for each NodePool, the cluster topology reconciler overwrites the replicas count as set by the cluster autoscaler. This limits enabling cluster autoscaler as a Day-1 op on a classy cluster. With this fix the topology reconciler will skip updating the replica field if the autoscaler annotations are present under the NodePool.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #7293

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 8, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @abhijit-dev82. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 8, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cecilerobertmichon for approval by writing /assign @cecilerobertmichon in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@fabriziopandini
Copy link
Member

/hold
I want to take a look a this beginning next week

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 8, 2022
@chrischdi
Copy link
Member

/retitle 🐛 Fix to enable Cluster Autoscaler with Replicas field set in a Classy Cluster

@k8s-ci-robot k8s-ci-robot changed the title :bug Fix to enable Cluster Autoscaler with Replicas field set in a Classy Cluster 🐛 Fix to enable Cluster Autoscaler with Replicas field set in a Classy Cluster Dec 8, 2022
Comment on lines +713 to +718
// Set the desired replicas only if external autoscaler is not controlling the MD replica count.
_, ok1 := machineDeploymentTopology.Metadata.Annotations[clusterv1.ClusterAutoscalerMaxAnnotation]
_, ok2 := machineDeploymentTopology.Metadata.Annotations[clusterv1.ClusterAutoscalerMinAnnotation]
if !ok1 || !ok2 {
desiredMachineDeploymentObj.Spec.Replicas = machineDeploymentTopology.Replicas
}
Copy link
Member

@fabriziopandini fabriziopandini Dec 12, 2022

Choose a reason for hiding this comment

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

Overall I think that the approach described in #7293 (comment) makes more sense than what is proposed in this PR, but probably we should make another round of discussion when @sbueringer is back

Getting to the proposed change

  • If I got right, this is going to modify the semantics about how the API behaves for adding the autoscaler, which is most likely a breaking that requires an API bump; the approach suggested in the link above instead does not require an API bump, making it possible to merge this feature in 1.4.
  • The proposed implementation is going tol tie current behavior to one autoscaler implementation, which will prevent eg. usage of other autoscalers (Add Karpenter support #7198); I don't think this is advisable
  • I'm not sure that the proposed change addresses the other concerns discussed on the related issue e.g.
    • if we create a new cluster with the autoscaler set and min replicas >1, the MS will continue to be created with replicas 1 and the autoscale won't add the missing replicas until the scheduler will require more compute resources
    • if we create a new cluster without the autoscaler and then add the autoscaler, the number of replicas will be reset to 1 no matter the current number of replicas or min/max replicas
    • other edge cases due to operations order/async controllers working on the same object

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 21, 2023
@fabriziopandini
Copy link
Member

/close
there is ongoing work on #7990 to solve this problem as discussed on the issue

@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: Closed this PR.

In response to this:

/close
there is ongoing work on #7990 to solve this problem as discussed on the issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MachineDeployment.spec.replicas defaulting should take into account autoscaler min/max size if defined
4 participants