fix(conditions): truncate condition messages exceeding Kubernetes 32768-byte limit#6158
Merged
EronWright merged 2 commits intomainfrom Apr 27, 2026
Merged
fix(conditions): truncate condition messages exceeding Kubernetes 32768-byte limit#6158EronWright merged 2 commits intomainfrom
EronWright merged 2 commits intomainfrom
Conversation
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…68-byte limit If an upstream source such as ArgoCD embeds a large payload (e.g. an entire pod spec) in an error message, that text can flow through the promotion engine into a Stage condition and cause every PatchStatus call to fail, leaving the Stage permanently stuck in "pending". Truncate condition messages to the Kubernetes-enforced 32768-byte limit inside conditions.Set so no single large upstream message can block a status update. The truncation is UTF-8-safe and appends " ... (truncated)" so operators know the message was cut. Fixes #6147 Signed-off-by: Eron Wright <eron.wright@akuity.io>
7de2003 to
052d41c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6158 +/- ##
==========================================
+ Coverage 57.37% 57.73% +0.35%
==========================================
Files 474 475 +1
Lines 49666 40550 -9116
==========================================
- Hits 28497 23411 -5086
+ Misses 19785 15746 -4039
- Partials 1384 1393 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jacobboykin
approved these changes
Apr 24, 2026
mogsie
reviewed
Apr 24, 2026
Position the multi-byte rune so its continuation byte falls exactly at the cut index, ensuring the walk-back loop is actually exercised. Signed-off-by: Eron Wright <eron.wright@akuity.io>
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.
Summary
Fixes #6147
When an upstream source such as ArgoCD embeds a large payload (e.g. an entire pod spec JSON) in a sync error, that text flows through the promotion engine into a Stage condition. Kubernetes enforces a hard 32768-byte limit on
status.conditions[*].message, so every subsequentPatchStatuscall fails, leaving the Stage permanently stuck in "pending".conditions.Set, the single choke point for all condition writes across all resource types" ... (truncated)"so operators know the message was cutTest plan
go test ./pkg/conditions/...passes — newTestTruncateMessageandTestSet_TruncatesLongMessagecases cover the boundary, the over-limit, and the multi-byte UTF-8 split case