Fix copilot TerminationGracePeriodSeconds set to nanoseconds instead of seconds#7183
Merged
pingsutw merged 2 commits intoflyteorg:masterfrom Apr 9, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Joakim Bergman <jocke@spotify.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Joakim Bergman <jocke@spotify.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7183 +/- ##
=======================================
Coverage 56.95% 56.95%
=======================================
Files 931 931
Lines 58188 58188
=======================================
Hits 33143 33143
Misses 22004 22004
Partials 3041 3041
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pingsutw
approved these changes
Apr 9, 2026
1 task
|
Congrats on merging your first pull request! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are the changes needed?
AddCoPilotToPodsetsTerminationGracePeriodSecondsby casting atime.Duration(which is stored as nanoseconds) directly to*int64:TerminationGracePeriodSecondsexpects seconds, not nanoseconds. With the default 1-hour timeout, this results in a grace period of ~114,000 years (3,600,000,000,000nanoseconds interpreted as seconds) instead of the intended 3,600 seconds.This causes pods with copilot sidecars to stay in
Terminatingstate effectively forever when a node is drained, since Kubernetes waits for the grace period to expire before sending SIGKILL.We discovered this while rotating GKE node pools in production. Pods with copilot sidecars were stuck in
Terminatingstate indefinitely, blocking node drain. Kubernetes was honoring the ~114,000-year grace period and never sending SIGKILL, making it impossible to cleanly decommission nodes without force-deleting pods.What changes were proposed in this pull request?
Replace the unsafe pointer cast with a proper conversion using
Duration.Seconds():This also eliminates the pointer aliasing into the config struct that the original code introduced.
How was this patch tested?
Added a unit test
TestAddCoPilotToPod/grace-periodthat sets a 1-hour timeout and asserts thatTerminationGracePeriodSecondsis3600(seconds), not3600000000000(nanoseconds).Labels
Check all the applicable boxes
Related PRs
#6501 — the PR that introduced the bug