kgateway version
main (also applies to v2.3.0)
Is your feature request related to a problem? Please describe.
The remote JWKS fetch timeout is hardcoded to 5s and cannot be configured on the JWT TrafficPolicy.
When a remote JWKS server is slow to respond (>5s), the fetch fails with Jwks_remote_fetch_is_failed / jwt_authn_access_denied, and there is no way to raise the timeout.
The JWT plugin already writes Envoy's remote_jwks.http_uri.timeout, but with a hardcoded constant:
// pkg/kgateway/extensions2/plugins/trafficpolicy/jwt.go
remoteJWKSTimeoutSecs = 5
...
HttpUri: &envoycorev3.HttpUri{
Timeout: &durationpb.Duration{Seconds: remoteJWKSTimeoutSecs}, // hardcoded 5s
Uri: remote.URL,
...
}
The RemoteJWKS API type (api/v1alpha1/kgateway/jwt_types.go) exposes cacheDuration, asyncFetch, and retryPolicy (added in #14054) but no timeout.
Envoy reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/http_uri.proto#envoy-v3-api-field-config-core-v3-httpuri-timeout
Describe the solution you'd like
Expose the timeout as an optional field on RemoteJWKS, defaulting to the current 5s when unset. This complements the async-fetch/retry/cache-duration work from #14054.
- Add
Timeout *metav1.Duration to the RemoteJWKS type, with duration-format validation matching the existing cacheDuration field.
- In
translateJwks, override HttpUri.Timeout when set; keep the 5s default otherwise.
- Regenerate CRDs + deepcopy, and add translation tests (default + configured value) alongside the existing
cacheDuration/asyncFetch cases.
Describe alternatives you've considered
Putting a caching proxy in front of the JWKS server, or relying on cacheDuration/asyncFetch. These help availability but don't address a slow first/refresh fetch, and none let a user control the fetch timeout directly.
Additional Context
No response
kgateway version
main (also applies to v2.3.0)
Is your feature request related to a problem? Please describe.
The remote JWKS fetch timeout is hardcoded to 5s and cannot be configured on the JWT
TrafficPolicy.When a remote JWKS server is slow to respond (>5s), the fetch fails with
Jwks_remote_fetch_is_failed/jwt_authn_access_denied, and there is no way to raise the timeout.The JWT plugin already writes Envoy's
remote_jwks.http_uri.timeout, but with a hardcoded constant:The
RemoteJWKSAPI type (api/v1alpha1/kgateway/jwt_types.go) exposescacheDuration,asyncFetch, andretryPolicy(added in #14054) but notimeout.Envoy reference: https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/http_uri.proto#envoy-v3-api-field-config-core-v3-httpuri-timeout
Describe the solution you'd like
Expose the timeout as an optional field on
RemoteJWKS, defaulting to the current 5s when unset. This complements the async-fetch/retry/cache-duration work from #14054.Timeout *metav1.Durationto theRemoteJWKStype, with duration-format validation matching the existingcacheDurationfield.translateJwks, overrideHttpUri.Timeoutwhen set; keep the 5s default otherwise.cacheDuration/asyncFetchcases.Describe alternatives you've considered
Putting a caching proxy in front of the JWKS server, or relying on
cacheDuration/asyncFetch. These help availability but don't address a slow first/refresh fetch, and none let a user control the fetch timeout directly.Additional Context
No response