Fixed a bug where hostname topology launched extra nodes #866
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Issue, if available:
2. Description of changes:
This bug is caused by the provisioners controller comparing the state of the current provisioner to the persisted provisioner state and the mutation happening in hostname topology. The scheduling logic mutates the provisioners' requirements, which causes the comparison to inadvertently force refresh the provisioner while nodes are being launched. This causes the provisioner to be drained, which can happen after launching capacity but before binding the pods. This results in multiple scale out (and eventual self-healing / scale-in).
The bug is due to me violating my own principles about not mutating state: https://github.com/aws/karpenter/blob/5d5798b5fefc757ef353889204c56138d8042066/pkg/controllers/provisioning/scheduling/topology.go#L99. In the long term, this mutation will be removed as part of a scheduling refactor.
3. Does this change impact docs?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.