-
Notifications
You must be signed in to change notification settings - Fork 911
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: check ephemeral metadata is set before delete #4089
fix: check ephemeral metadata is set before delete #4089
Conversation
e89d0ad
to
3f8a37c
Compare
Published E2E Test Results 4 files 4 suites 3h 8m 18s ⏱️ Results for commit 289a3eb. ♻️ This comment has been updated with latest results. |
Published Unit Test Results2 294 tests 2 294 ✅ 2m 59s ⏱️ Results for commit 289a3eb. ♻️ This comment has been updated with latest results. |
if _, ok := metadata.Annotations[k]; !ok { | ||
continue | ||
} | ||
delete(metadata.Annotations, k) | ||
modified = true |
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.
Code can be clearer if the lookup check that the variable exists
if _, ok := metadata.Annotations[k]; !ok { | |
continue | |
} | |
delete(metadata.Annotations, k) | |
modified = true | |
if _, ok := metadata.Annotations[k]; ok { | |
delete(metadata.Annotations, k) | |
modified = true | |
} |
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 prefer to keep the code left and return/continue early, but happy to change it if you think it's better https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88
51275cf
to
31e75a1
Compare
Signed-off-by: Jordan Rodgers <jrodgers@figma.com>
Signed-off-by: Jordan Rodgers <jrodgers@figma.com>
Signed-off-by: Jordan Rodgers <jrodgers@figma.com>
31e75a1
to
289a3eb
Compare
|
* fix: check ephemeral metadata is set before delete Signed-off-by: Jordan Rodgers <jrodgers@figma.com> * add test case Signed-off-by: Jordan Rodgers <jrodgers@figma.com> * address test comments Signed-off-by: Jordan Rodgers <jrodgers@figma.com> --------- Signed-off-by: Jordan Rodgers <jrodgers@figma.com>
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.
awesome
* fix: check ephemeral metadata is set before delete Signed-off-by: Jordan Rodgers <jrodgers@figma.com> * add test case Signed-off-by: Jordan Rodgers <jrodgers@figma.com> * address test comments Signed-off-by: Jordan Rodgers <jrodgers@figma.com> --------- Signed-off-by: Jordan Rodgers <jrodgers@figma.com>
We're seeing issues with rollout sync failing due to errors like this:
It seems that we're trying to delete the metadata on every pod every sync, even if the pod doesn't have the keys. This means that in environments with high pod churn, this loop can get stuck for a very long time. This simply adds a check to make sure the key is actually present in the metadata before we delete it and mark it as modified.
Before the fix with the new test:
After the fix with the new test:
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.