-
Notifications
You must be signed in to change notification settings - Fork 387
Ignore ASG desiredCapacity when it's not set to make it compatible with the cluster-autoscaler #1797
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
Conversation
Signed-off-by: handlerww <[email protected]>
5694dc7
to
736206b
Compare
@MisterMX can you take a looK? |
in.DesiredCapacity = awsclients.LateInitializeInt64Ptr(in.DesiredCapacity, obs.DesiredCapacity) | ||
// if desiredCapacity is not set, don't update the value | ||
if in.DesiredCapacity != nil { | ||
in.DesiredCapacity = awsclients.LateInitializeInt64Ptr(in.DesiredCapacity, obs.DesiredCapacity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I understand the issue this change wants to tackle I don't think it makes sense the way it is implemented: LateInitialize
is supposed to set update the spec with the observed value if the former is nil.
Also, LateInitializeInt64Ptr
only updates the value if in.DesiredCapacity == nil
(see here). So this change would effectively cause in.DesiredCapacity
to be never late initialized.
I think it makes more sense to explicitly specify the desired behaviour of the controller rather then doing it implicitly through a special prop value. It could by defining a new property (i.e. scalingMode: Managed | External
) that tells the controller to not set the value in the request to AWS during Update
.
This issue will also be addressed by the Observe Only feature where you will be able to set |
So, would it be addressed in Ignore Changes? It seems like a better solution. |
Yes, my mistake. Thanks for the correction. |
Description of your changes
As mentioned in https://github.com/crossplane/crossplane/blob/master/design/one-pager-ignore-changes.md?plain=1#L24-L27 and #502, there is a race condition
between crossplane and cluster autoscaler. When we use asg as self-managed nodegroup with cluster-autoscaler, the reconciling of crossplane asg controller will revert changes from cluster-autoscaler. If
desiredCapacity
is not set, we should leave it blank, and just let the cluster-autoscaler to manage it. This PR implements a similar logic in the managed nodegroup.I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
I've manually test it, the test plan is here:
a. create a ASG without
desiredCapacity
, the ASG can be created.b. create a ASG with
desiredCapacity
, the ASG configuration is as expected.a. modify ASG configuration on AWS console, modify the maxSize to 401, trigger the reconciling, the
desiredCapacity
doesn't change.b. add
desiredCapacity
configuration on ASG CR, the ASG configuration on AWS console changes as expected.c. remove
desiredCapacity
configuration from ASG CR, and modify the configuration on AWS console, it works as expected.