-
Notifications
You must be signed in to change notification settings - Fork 616
Support for configurable tls in remote jwks store #13014
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
…ayPolicy Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
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 introduces support for configurable TLS options when connecting to remote JWKS sources in the JWKS store. It allows users to specify custom TLS configurations via BackendTLSPolicy by setting a backendRef on an AgentgatewayPolicy.
Key changes include:
- Refactored JWKS store architecture to use event-driven updates via channels instead of queue-based polling
- Added support for custom TLS configurations per JWKS source through
BackendTLSPolicyintegration - Separated concerns into dedicated controllers: policy controller for JWKS source changes and ConfigMap controller for persistence
- Improved security by removing default
InsecureSkipVerify: truefrom HTTP clients
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
internal/kgateway/jwks/jwks_store.go |
Refactored to use channel-based updates; added mapping between ConfigMap names and JWKS URIs |
internal/kgateway/jwks/jwks_fetcher.go |
Added TLS configuration support per keyset; simplified keyset management API; removed default insecure TLS |
internal/kgateway/jwks/jwks_cache.go |
Added thread-safe methods with mutex locks; removed comparison logic from add operation |
internal/kgateway/jwks/config_map_syncer.go |
Simplified by removing write logic and KRT collection; now only handles loading ConfigMaps |
internal/kgateway/agentjwksstore/policy_controller.go |
New controller that watches policies and creates JWKS sources with TLS configs from BackendTLSPolicy |
internal/kgateway/agentjwksstore/cm_controller.go |
New controller that persists JWKS to ConfigMaps using event queue pattern |
internal/kgateway/controller/start.go |
Updated to initialize new controllers in correct order |
internal/kgateway/jwks/jwks_fetcher_test.go |
Updated tests to use new defaultJwksClient field name |
api/v1alpha1/agentgateway_policy_types.go |
Made BackendRef a pointer and JwksUri required; removed mutual exclusivity validation |
install/helm/kgateway-crds/templates/gateway.kgateway.dev_agentgatewaypolicies.yaml |
Updated CRD to reflect API changes |
api/v1alpha1/zz_generated.deepcopy.go |
Generated code for pointer-based BackendRef deep copy |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
…-controller Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
…-controller Signed-off-by: Dmitri Dolguikh <[email protected]>
…-controller Signed-off-by: Dmitri Dolguikh <[email protected]>
…-controller Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Signed-off-by: Dmitri Dolguikh <[email protected]>
Description
This PR depends on changes in #13011. The PR introduces support for setting of tls options for connections to remote jwks sources in jwks store. This is accomplished by setting a
backendRefon aAgentgatewayPolicy, finding a matchingBackendTLSPolicy, and using it to configure tls options.If no
BackendTLSPolicyis present, an http client with default tls options is used (including settingInsecureSkipVerifyto false).Implemenation Notes
InsecureSkipVerify. I don't think we support this anywhere else, could be confusing.Change Type
/kind feature
Changelog
Additional Notes
BackendRefisn't the only possible way to configure tls options for a policy; we haveAgentgatewayPolicyBackendSimple(https://github.com/kgateway-dev/kgateway/blob/main/api/v1alpha1/agentgateway_policy_types.go#L120), which is used to configure agent policy backends, and allows for setting of tls, tcp, and http options on connections to backends. A jwks backend could be introduced to support setting of jwks url and connection options; tls for now, but possibly tcp in the future (retries comes first to mind). It might look something like:Same policy, but tls options are configured using
BackendTLSPolicy(this is implemented in this PR):I think the former is a better UX (simpler and more consistent between use-cases). There also might be an issue (not sure how realistic) when the same tls policy is applied to both jwks store traffic (traffic from the control plane) and to data-plane traffic.
Looking at MCP auth work (https://github.com/kgateway-dev/kgateway/pull/12966/files#diff-fb00835f76278e918399f81876d65569108fbd35b466698137ebae0c1c985ffdR44), another approach could be to use
the
backendfield inAgentgatewayPolicy(otherwise this is similar to the jwks backend example above).It would also mean that MCP auth config and remote jwks configs would be in-line with each other.