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 rolling-update rollback from an unavailable rc #18583

Merged
merged 1 commit into from
Dec 16, 2015

Conversation

jsravn
Copy link
Contributor

@jsravn jsravn commented Dec 11, 2015

Rolling back from a broken update with only one replica fails with a
timeout in the existing code.

The problem is the scale down logic does not consider unavailable
replicas in the old replication controller when calculating how much to
scale down by. This leads to an obvious problem with a single replica
when min unavailable is 1.

The fix is to allow scaling down all unavailable replicas in the old
controller, while still maintaining the min unavailable invariant.

Fix #18530

@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 11, 2015
@k8s-bot
Copy link

k8s-bot commented Dec 11, 2015

Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist")

If this message is too spammy, please complain to ixdy.

@j3ffml
Copy link
Contributor

j3ffml commented Dec 12, 2015

@k8s-bot ok to test

decrement := (oldAvailable + newAvailable) - minAvailable
// Scale down as much as possible while maintaining minimum availability
unavailableOldReplicas := oldRc.Spec.Replicas - oldAvailable
decrement := unavailableOldReplicas + (oldAvailable + newAvailable) - minAvailable
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this just be oldRc.Spec.Replicas + newAvailable - minAvailable? The math is the same.

@j3ffml
Copy link
Contributor

j3ffml commented Dec 13, 2015

Thanks for the pr @jsravn. cc @ironcladlou

@k8s-bot
Copy link

k8s-bot commented Dec 13, 2015

GCE e2e test build/test passed for commit ffef16033a83e187dd558d92ac6303b2f75982e8.

@k8s-github-robot
Copy link

The author of this PR is not in the whitelist for merge, can one of the admins add the 'ok-to-merge' label?

@jsravn
Copy link
Contributor Author

jsravn commented Dec 13, 2015

@jlowdermilk I made the recommended change.

@k8s-bot
Copy link

k8s-bot commented Dec 13, 2015

GCE e2e test build/test passed for commit 4a6eb4440318de05f69880f6bacd2732985cda18.

@@ -692,6 +693,45 @@ func TestUpdate_progressTimeout(t *testing.T) {
}
}

func TestUpdate_canRollbackFromAFailedRcToAReadyRc(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Were you unable to express this as a scenario in TestUpdate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look. I assumed it can't be because the test above it, TestUpdate_progressTimeout, is also a timeout scenario and not part of TestUpdate.

@jsravn
Copy link
Contributor Author

jsravn commented Dec 14, 2015

@ironcladlou Made the change, thanks.

@k8s-github-robot
Copy link

Labelling this PR as size/S

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 14, 2015
@k8s-bot
Copy link

k8s-bot commented Dec 14, 2015

GCE e2e test build/test passed for commit dcdb8f91f447343bf427a9550b8553b50a5f858e.

@ironcladlou
Copy link
Contributor

@jsravn

Made the change, thanks.

Awesome, thank you!

@ironcladlou
Copy link
Contributor

This lgtm

@j3ffml j3ffml added lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-merge and removed needs-ok-to-merge lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Dec 14, 2015
@j3ffml
Copy link
Contributor

j3ffml commented Dec 14, 2015

@jsravn, please squash commits.

Rolling back from a broken update with only one replica fails with a
timeout in the existing code.

The problem is the scale down logic does not consider unavailable
replicas in the old replication controller when calculating how much to
scale down by. This leads to an obvious problem with a single replica
when min unavailable is 1.

The fix is to allow scaling down all unavailable replicas in the old
controller, while still maintaining the min unavailable invariant.
@k8s-bot
Copy link

k8s-bot commented Dec 14, 2015

GCE e2e test build/test passed for commit e5a558c.

@jsravn
Copy link
Contributor Author

jsravn commented Dec 15, 2015

@jlowdermilk Squashed them.

@j3ffml j3ffml added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 15, 2015
@j3ffml
Copy link
Contributor

j3ffml commented Dec 15, 2015

Thanks, lgtm.

@j3ffml j3ffml assigned j3ffml and unassigned smarterclayton Dec 15, 2015
@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Dec 16, 2015

GCE e2e test build/test passed for commit e5a558c.

j3ffml added a commit that referenced this pull request Dec 16, 2015
Fix rolling-update rollback from an unavailable rc
@j3ffml j3ffml merged commit 6adf227 into kubernetes:master Dec 16, 2015
@nikhiljindal
Copy link
Contributor

Thanks for fixing this @jsravn!
I think it will be good to cherrypick this in 1.1.
Can you please send a cherrypick request?
https://github.com/kubernetes/kubernetes/blob/master/docs/devel/cherry-picks.md has the details.

@jsravn
Copy link
Contributor Author

jsravn commented Dec 17, 2015

Will do.

@jsravn jsravn deleted the fix-rolling-update-rollback branch December 17, 2015 11:41
k8s-github-robot referenced this pull request Dec 21, 2015
…-upstream-release-1.1

Auto commit by PR queue bot
shyamjvs referenced this pull request in shyamjvs/kubernetes Dec 1, 2016
…-of-#18583-upstream-release-1.1

Auto commit by PR queue bot
shouhong referenced this pull request in shouhong/kubernetes Feb 14, 2017
…-of-#18583-upstream-release-1.1

Auto commit by PR queue bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

Rolling update can't rollback with only 1 replica
9 participants