-
Notifications
You must be signed in to change notification settings - Fork 630
support remote jwks #12939
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
support remote jwks #12939
Conversation
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.
Pull Request Overview
This PR adds support for remote JWKS (JSON Web Key Set) in JWT authentication, allowing JWT validation keys to be fetched from a remote JWKS server instead of only supporting local inline or ConfigMap-based keys.
Key Changes:
- Added
RemoteJWKSAPI type with URL, backend reference, and optional cache duration - Extended JWT translation logic to handle remote JWKS with cluster references and HTTP timeouts
- Added comprehensive unit tests and an end-to-end test case for remote JWKS
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
api/v1alpha1/jwt_types.go |
Adds RemoteJWKS struct with URL, BackendRef, and CacheDuration fields; updates JWKS to include optional RemoteJWKS |
api/v1alpha1/zz_generated.deepcopy.go |
Auto-generated DeepCopy methods for RemoteJWKS struct |
install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayextensions.yaml |
Adds CRD schema for remote JWKS with validation rules for BackendRef and cacheDuration |
internal/kgateway/extensions2/plugins/trafficpolicy/jwt.go |
Implements remote JWKS translation to Envoy RemoteJwks config with cluster resolution and timeout handling |
internal/kgateway/extensions2/plugins/trafficpolicy/jwt_test.go |
Adds unit tests for remote JWKS translation including success and error cases |
internal/kgateway/extensions2/plugins/trafficpolicy/gateway_extension.go |
Updates JWT provider resolution to pass backend resolver and object source for remote JWKS support |
internal/kgateway/translator/gateway/gateway_translator_test.go |
Adds integration test case for remote JWKS functionality |
internal/kgateway/translator/gateway/testutils/inputs/jwt/httproute-remote-jwks.yaml |
Test input with remote JWKS configuration referencing a service backend |
internal/kgateway/translator/gateway/testutils/outputs/jwt/httproute-remote-jwks.yaml |
Expected Envoy configuration output with remote JWKS cluster reference and cache settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayextensions.yaml
Show resolved
Hide resolved
Signed-off-by: omar <[email protected]>
7388a48 to
ea30c45
Compare
| jwtFilterNamePrefix = "jwt" | ||
| jwtConfigMapKey = "jwks" | ||
|
|
||
| remoteJWKSTimeoutSecs = 5 |
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 don't see an API value for this, is this just hardcoded?
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.
yup for now
internal/kgateway/extensions2/plugins/trafficpolicy/gateway_extension.go
Outdated
Show resolved
Hide resolved
- rename policySrc to gwExtObj - remove unneeded nil check for resolver Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
Signed-off-by: omar <[email protected]>
internal/kgateway/translator/gateway/testutils/inputs/jwt/cross-namespace.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: omar <[email protected]>
lgadban
left a comment
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.
LGTM
| message: Successfully resolved all references | ||
| reason: ResolvedRefs | ||
| status: "True" | ||
| type: ResolvedRefs |
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.
this doesn't seem correct but is likely existing behavior.
i.e. it's hard for policy to influence the ResolvedRefs condition of the route
Description
add support for remote JWKS leveraging envoy.
Change Type
/kind new_feature
Changelog
Additional Notes