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

Delete MachineAutoscalers that would get MaxReplicas==0 #2229

Merged

Conversation

2uasimojo
Copy link
Member

@2uasimojo 2uasimojo commented Mar 11, 2024

MachineAutoscalers are not allowed to have MaxReplicas==0.

PR #2215 / bce2d47 partially fixed the scenario where a MachinePool's autoscaling maxReplicas is less than the number of AZs by causing such MAs not to be created. However, when reducing the MachinePool's maxReplicas to below the number of AZs, we were still trying to update existing MAs to have MaxReplicas==0. This commit adjusts the logic to delete them instead.

HIVE-2415

@2uasimojo
Copy link
Member Author

/assign @lleshchi

@openshift-ci openshift-ci bot requested review from dlom and jstuever March 11, 2024 22:17
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2024
@@ -853,25 +853,29 @@ func (r *ReconcileMachinePool) syncMachineAutoscalers(
maLog.WithField("desired", minReplicas).
WithField("observed", rMA.Spec.MinReplicas).
Info("min replicas out of sync")
rMA.Spec.MinReplicas = minReplicas
remoteMachineAutoscalers.Items[j].Spec.MinReplicas = minReplicas
Copy link
Member Author

Choose a reason for hiding this comment

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

Note to reviewers: Had to change this block to operate on the original (it was previously operating on the loop variable, which was an ephemeral copy scoped to this block) so we can detect maxReplicas==0 below in the deletion discovery path.

Comment on lines +1329 to +1330
assert.Equal(t, *eMS.Spec.Replicas, *rMS.Spec.Replicas, "Replicas for %s", rMS.Name)
assert.Equal(t, eMS.Generation, rMS.Generation, "Generation for %s", rMS.Name)
Copy link
Member Author

Choose a reason for hiding this comment

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

ntr: mostly-unrelated change, makes debugging easier.

MachineAutoscalers are not allowed to have MaxReplicas==0.

PR openshift#2215 / bce2d47 partially fixed the scenario where a MachinePool's
autoscaling maxReplicas is less than the number of AZs by causing such
MAs not to be *created*. However, when reducing the MachinePool's
maxReplicas to below the number of AZs, we were still trying to update
*existing* MAs to have MaxReplicas==0. This commit adjusts the logic to
delete them instead.

HIVE-2415
@2uasimojo
Copy link
Member Author

/override ci/prow/security

addressed by #2231

Copy link
Contributor

openshift-ci bot commented Mar 11, 2024

@2uasimojo: Overrode contexts on behalf of 2uasimojo: ci/prow/security

In response to this:

/override ci/prow/security

addressed by #2231

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.

Copy link
Contributor

openshift-ci bot commented Mar 12, 2024

@2uasimojo: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.31%. Comparing base (8c95b6a) to head (8d2b041).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2229      +/-   ##
==========================================
+ Coverage   58.29%   58.31%   +0.01%     
==========================================
  Files         182      182              
  Lines       25691    25692       +1     
==========================================
+ Hits        14977    14982       +5     
+ Misses       9455     9451       -4     
  Partials     1259     1259              
Files Coverage Δ
...g/controller/machinepool/machinepool_controller.go 54.63% <100.00%> (+0.55%) ⬆️

@lleshchi
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 12, 2024
Copy link
Contributor

openshift-ci bot commented Mar 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 2uasimojo, lleshchi

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

@openshift-merge-bot openshift-merge-bot bot merged commit 0dd0fcc into openshift:master Mar 12, 2024
9 checks passed
@2uasimojo
Copy link
Member Author

/cherry-pick mce-2.5

@openshift-cherrypick-robot

@2uasimojo: new pull request created: #2233

In response to this:

/cherry-pick mce-2.5

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.

@2uasimojo 2uasimojo deleted the HIVE-2415/scale-down branch March 12, 2024 14:14
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants