-
Notifications
You must be signed in to change notification settings - Fork 558
feat: add cacheDuration for remoteJWKS in SecurityPolicy #6641
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
feat: add cacheDuration for remoteJWKS in SecurityPolicy #6641
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6641 +/- ##
==========================================
+ Coverage 70.97% 71.03% +0.06%
==========================================
Files 227 227
Lines 40461 40470 +9
==========================================
+ Hits 28716 28747 +31
+ Misses 10039 10022 -17
+ Partials 1706 1701 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d2ae94e
to
76240ec
Compare
api/v1alpha1/jwt_types.go
Outdated
// +kubebuilder:default="300s" | ||
// +kubebuilder:validation:Format=duration | ||
// +optional | ||
CacheDuration *metav1.Duration `json:"cacheDuration,omitempty"` |
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.
lets use gwapiv1.Duration here
api/v1alpha1/jwt_types.go
Outdated
|
||
// Fetch Jwks asynchronously in the main thread before the listener is activated. Fetched Jwks can be used by all worker threads. | ||
// +optional | ||
AsyncFetch *JwksAsyncFetch `json:"asyncFetch,omitempty"` |
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.
can we rm AsyncFetch from this API PR, since its already enabled by default
prefer if we address retry semantics as part of #6525
this should help make this PR move faster
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.
Ok, so if I understand it correctly, in this PR, we just want to add the CacheDuration field and not the AsyncFetch field right?
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.
yeah thanks
76240ec
to
7804d1f
Compare
Hey @arkodg , I see that conformance-test is failing for v1.32.5 . I tried runing it locally and it passed. Edit: I see it been passed now |
internal/ir/xds.go
Outdated
// JwksAsyncFetch is used to Fetch Jwks asynchronously in the main thread before the listener is activated. | ||
// | ||
// +k8s:deepcopy-gen=true | ||
type JwksAsyncFetch struct { |
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.
can we rm this from this PR
internal/xds/translator/jwt.go
Outdated
|
||
var duration *gwapiv1.Duration | ||
if jwks.CacheDuration != nil { | ||
duration = jwks.CacheDuration |
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.
since we are relying on a ptr value, preference here would be to wrap it around
if jwks.CacheDuration != nil {
cur, err := time.ParseDuration(string(*jwks.CacheDuration))
if err != nil {
return nil, err
}
remote.CacheDuration = cDur
}
api/v1alpha1/jwt_types.go
Outdated
// Duration after which the cached JWKS should be expired. If not specified, default cache duration is 5 minutes. | ||
|
||
// +kubebuilder:default="300s" | ||
// +kubebuilder:validation:Format=duration |
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.
lets rm // +kubebuilder:validation:Format=duration
, we are relying on CEL validations of gwapiv1.Duration
f594d42
to
98ce496
Compare
thanks @slayer321 can you fix make gen, by running |
can you fix the CI errors @slayer321 ? |
94fae34
to
80d9bda
Compare
internal/ir/xds.go
Outdated
URI string `json:"uri"` | ||
|
||
// Duration after which the cached JWKS should be expired. If not specified, default cache duration is 5 minutes. | ||
CacheDuration *gwapiv1.Duration `json:"cacheDuration,omitempty"` |
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.
can you follow similar time fields in this file, which use metav1.Duration
here to simplify test comparison
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.
eariler metav1.Duration
was used but as mentioned here I updated it to gwapiv1.Duration
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.
Meta is under in the IR
36e15c7
to
c800b8c
Compare
Hey @arkodg , I see two of the e2e tests are failing .. I check the logs and can see in |
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 thanks
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.
can you add a release notes?
6c27f59
to
ab1467d
Compare
…rityPolicy Signed-off-by: sachin maurya <[email protected]>
Signed-off-by: sachin maurya <[email protected]>
…tion Signed-off-by: sachin maurya <[email protected]>
Signed-off-by: sachin maurya <[email protected]>
Signed-off-by: sachin maurya <[email protected]>
Signed-off-by: sachin maurya <[email protected]>
Signed-off-by: sachin maurya <[email protected]>
ca3f501
to
d8d4847
Compare
What type of PR is this?
feat: add cacheDuration and asyncFetch support for remoteJWKS in SecurityPolicy
What this PR does / why we need it:
Adds support for two new field under remoteJWKS i.e
cacheDuration
andasyncFetch
Which issue(s) this PR fixes:
Fixes #6520
Release Notes: Yes