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

Switch from updating to patching the target #187

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

iroller
Copy link
Contributor

@iroller iroller commented Dec 19, 2023

Fix the race condition for target resources that can be changed during CPA operations:

Error while autoscaling: failed to scale resource: failed to apply scaling changes to resource:

Operation cannot be fulfilled on deployments.apps:
the object has been modified; please apply your changes to the latest version and try again.

One of the common reasons for this issue is status.availableReplicas field being updated multiple times a second in large churning Deployments. Each time resource changes Kubernetes updates metadata.resourceVersion and rejects the update if resource versions do not match.

Switching to patching only the replica count helps to avoid the issue altogether. This patch should work for all supported target resource types.

Copy link
Owner

@jthomperoo jthomperoo left a comment

Choose a reason for hiding this comment

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

This all looks good to me - thanks for the explanation of the change and the pull request, well written and easy for me to follow.

Merging now, will cut a new version v2.9.0 with these changes in it.

@jthomperoo jthomperoo merged commit 55b9845 into jthomperoo:master Dec 23, 2023
1 check passed
@jthomperoo
Copy link
Owner

Now available in v2.9.0 - thanks for submitting this change.

@iroller iroller deleted the switch_to_patching branch January 3, 2024 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants