fix(gatewayapi): sort api key auth credentials#9042
Open
nobbs wants to merge 4 commits into
Open
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a9bfe1d to
46f9774
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9042 +/- ##
==========================================
+ Coverage 74.76% 74.81% +0.05%
==========================================
Files 252 252
Lines 40571 40576 +5
==========================================
+ Hits 30331 30356 +25
+ Misses 8166 8149 -17
+ Partials 2074 2071 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
46f9774 to
6825ffc
Compare
7cd801c to
e7efd21
Compare
zirain
previously approved these changes
May 22, 2026
Signed-off-by: Alexej Disterhoft <alexej.disterhoft@redcare-pharmacy.com>
Signed-off-by: Alexej Disterhoft <alexej.disterhoft@redcare-pharmacy.com>
e7efd21 to
ffc44f2
Compare
Signed-off-by: Alexej Disterhoft <alexej@disterhoft.de>
zirain
approved these changes
May 25, 2026
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.
What type of PR is this?
fix
What this PR does / why we need it:
API key auth credentials are currently built by iterating over
Secret.Datadirectly. SinceSecret.Datais a Go map, the credential order can vary between otherwise equivalent translations.That nondeterministic order is preserved into the generated API key auth filter and per-route xDS config. In clusters with frequent Gateway API/xDS rebuilds, Envoy can receive byte-different listener or route resources even when the effective API key auth configuration did not change. For long-lived connections such as WebSockets, this can cause Envoy to replace the active filter chain and close existing connections with:
This PR makes API key auth credential generation deterministic by sorting the secret data keys before appending credentials to the IR. It also adds a unit test that verifies credentials are emitted in stable client ID order.
With this change applied in a reproducing environment, the internal HTTPS listener stopped flipping due to API key credential reordering and the WebSocket connection stayed alive.
Validation:
make generate gen-checkgo test ./internal/gatewayapiWhich issue(s) this PR fixes:
Fixes #8889
Release Notes: Yes