-
Notifications
You must be signed in to change notification settings - Fork 40k
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 bug when getting old RCs of a deployment #18321
Fix bug when getting old RCs of a deployment #18321
Conversation
Labelling this PR as size/XS |
Thanks for finding and fixing this! travis is complaining that you need to run gofmt |
66cf245
to
524ec8b
Compare
GCE e2e build/test failed for commit 524ec8b. |
// which means the 'value' returned from range will have the same address. | ||
// Therefore, we should use the returned 'index' instead. | ||
for i := range oldRCs { | ||
value := oldRCs[i] | ||
requiredRCs = append(requiredRCs, &value) |
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.
&oldRCs[i]
without the temporary variable also works :)
LGTM-- my comments are optional. Feel free to apply the label yourself when the tests are happy (just a flake?) |
@k8s-bot e2e test this |
GCE e2e build/test failed for commit 524ec8b. |
Unrelated flaky tests fail. |
GCE e2e build/test failed for commit 524ec8b. |
Unrelated flaky tests. @k8s-bot e2e test this |
GCE e2e build/test failed for commit 524ec8b. |
GCE e2e build/test failed for commit 524ec8b. |
We should have unit tests for deployment utils |
// Note that go reuses the same memory location for every iteration, | ||
// which means the 'value' returned from range will have the same address. | ||
// Therefore, we should use the returned 'index' instead. | ||
for i := range oldRCs { |
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.
I would call this a key instead of an index since this is a map and not a slice.
@k8s-bot e2e test this |
GCE e2e test build/test passed for commit 524ec8b. |
@k8s-bot test this Tests are more than 48 hours old. Re-running tests. |
GCE e2e test build/test passed for commit 524ec8b. |
Will add the unit tests in a separate PR. |
Fix bug when getting old RCs of a deployment
…21-upstream-release-1.1 Automated cherry pick of #18321 upstream release 1.1
…ck-of-#18321-upstream-release-1.1 Automated cherry pick of kubernetes#18321 upstream release 1.1
…ck-of-#18321-upstream-release-1.1 Automated cherry pick of kubernetes#18321 upstream release 1.1
Deployment has be acting unexpectedly for certain cases. Hunted down the failed cases and found that there's a bug when getting old RCs. Fix the bug that
GetOldRCs
returns a list of the same old RC incorrectly (becauserange
reuses the same memory location).cc @lavalamp @nikhiljindal @kubernetes/sig-config