Repository navigation
perf: deduplicate JWT authn providers - #9430
Conversation
Signed-off-by: liuhy <[email protected]>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86ee3dd5dd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR addresses #9103 by deduplicating identical Envoy jwt_authn providers and requirements at the listener level, so adding routes that reuse the same JWT configuration avoids LDS changes that only introduce duplicate providers/requirementMap entries. It does so by deriving provider and requirement names from deterministic protobuf-serialization hashes of the generated Envoy JWT config.
Changes:
- Refactors JWT authn translation to generate provider/requirement names from deterministic proto hashes and share identical entries across routes.
- Updates per-route
jwt_authnPerRouteConfigto reference the shared hashed requirement name. - Adds a focused unit test and refreshes translator golden xDS IR outputs and release-note fragment.
Reviewed changes
Copilot reviewed 3 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| release-notes/current/performance_improvements/9103-dedupe-jwt-authn-providers.md | Adds release-note fragment for JWT authn deduplication behavior. |
| internal/xds/translator/jwt.go | Implements hash-derived naming + dedup logic for JWT providers/requirements and updates per-route requirement references. |
| internal/xds/translator/jwt_test.go | Adds a unit test asserting identical route providers are deduped and routes reference the shared requirement. |
| internal/xds/translator/testdata/out/xds-ir/securitypolicy-with-oidc-jwt-authz.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/securitypolicy-with-oidc-jwt-authz.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/oidc-and-jwt-with-passthrough.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/oidc-and-jwt-with-passthrough.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/mixed-tls-jwt-authn.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/mixed-tls-jwt-authn.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-with-backend-tls-retry.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/jwt-with-backend-tls-retry.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-single-route-single-match.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/jwt-single-route-single-match.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-ratelimit.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/jwt-ratelimit.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-optional.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/jwt-optional.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-multi-route-single-provider.routes.yaml | Updates golden route output to reference hashed JWT requirement names per route. |
| internal/xds/translator/testdata/out/xds-ir/jwt-multi-route-single-provider.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-multi-route-multi-provider.routes.yaml | Updates golden route output to reference hashed JWT requirement names per route. |
| internal/xds/translator/testdata/out/xds-ir/jwt-multi-route-multi-provider.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-from-multiple-listeners.routes.yaml | Updates golden route output to reference hashed JWT requirement names per domain/route. |
| internal/xds/translator/testdata/out/xds-ir/jwt-from-multiple-listeners.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/jwt-custom-extractor.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/jwt-custom-extractor.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/custom-filter-order.routes.yaml | Updates golden route output to reference hashed JWT requirement name. |
| internal/xds/translator/testdata/out/xds-ir/custom-filter-order.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/authorization-jwt-scope.routes.yaml | Updates golden route output to reference hashed JWT requirement names for authz scenarios. |
| internal/xds/translator/testdata/out/xds-ir/authorization-jwt-scope.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
| internal/xds/translator/testdata/out/xds-ir/authorization-jwt-claim.routes.yaml | Updates golden route output to reference hashed JWT requirement names for claim-based authz. |
| internal/xds/translator/testdata/out/xds-ir/authorization-jwt-claim.listeners.yaml | Updates golden listener output for hashed provider/requirement keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: liuhy <[email protected]>
|
Addressed the review feedback in commit 3d05fae:\n\n- Switched JWT authn provider/requirement hashing to use the full SHA-256 digest instead of a truncated 64-bit prefix.\n- Moved the release note from performance improvements to breaking changes and called out the generated xDS name change impact.\n- Regenerated the affected xDS and egctl translate golden files.\n\nLocal verification:\n- go test ./internal/xds/translator -count=1\n- go test ./internal/cmd/egctl -run TestTranslate -count=1\n- bash tools/hack/check-release-notes-filenames.sh\n\nI also attempted make gen-check, but it failed while reaching the external Helm prometheus-community chart repository with a context deadline exceeded error before completing the repo diff check. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9430 +/- ##
==========================================
- Coverage 75.35% 75.34% -0.01%
==========================================
Files 252 252
Lines 41475 41533 +58
==========================================
+ Hits 31254 31295 +41
- Misses 8108 8118 +10
- Partials 2113 2120 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
/retest |
zhaohuabing
left a comment
There was a problem hiding this comment.
Overall, this looks good. I just have a few minor nits about the requirement and provider naming.
Follow the sdsClusterNameFromURL precedent by using a 16-char hash prefix, drop the redundant jwt/provider and jwt/requirement prefixes, and include the referenced provider names in the requirement name for readability. Regenerate affected xDS and egctl translate golden files. Signed-off-by: liuhy <[email protected]>
2bb8462 to
91a2986
Compare
Cap generated JWT provider and requirement names at maxJWTNameLength via boundedJWTName, truncating the human-readable prefix while always keeping the content hash suffix, so combining many providers cannot produce a name long enough to fail Envoy xDS validation. Add a test covering the bound. Signed-off-by: liuhy <[email protected]>
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What this PR does / why we need it
Fixes #9103 by deduplicating identical JWT authentication providers and requirements in listener xDS config. Routes that reuse the same JWT provider now point at a shared
jwt_authnrequirement, avoiding LDS changes that only add duplicate provider/requirement entries.Which issue(s) this PR fixes
Fixes #9103
Special notes for your reviewer
The provider and requirement names are now derived from deterministic protobuf serialization hashes of the generated Envoy JWT config. This keeps providers with different settings separate while allowing identical ones to share listener-level config.
Does this PR introduce a user-facing change?
Testing
go test ./internal/xds/translator -run 'TestJWTAuthnDeduplicatesIdenticalRouteProviders|TestTranslateXds' -count=1\n-go test ./internal/xds/translator -count=1\n-go test ./internal/xds/... -count=1\n-bash tools/hack/check-release-notes-filenames.sh\n\nDCO\n\nCommit was created withgit commit -s.\n