Skip to content

Commit 98ce496

Browse files
committed
remove asyncFetch struct from xds ir
Signed-off-by: sachin maurya <[email protected]>
1 parent 3deedc6 commit 98ce496

File tree

6 files changed

+8
-48
lines changed

6 files changed

+8
-48
lines changed

api/v1alpha1/jwt_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ type RemoteJWKS struct {
113113
// Duration after which the cached JWKS should be expired. If not specified, default cache duration is 5 minutes.
114114

115115
// +kubebuilder:default="300s"
116-
// +kubebuilder:validation:Format=duration
117116
// +optional
118117
CacheDuration *gwapiv1.Duration `json:"cacheDuration,omitempty"`
119118
}

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_securitypolicies.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3766,7 +3766,6 @@ spec:
37663766
description: |-
37673767
Duration is a string value representing a duration in time. The format is as specified
37683768
in GEP-2257, a strict subset of the syntax parsed by Golang time.ParseDuration.
3769-
format: duration
37703769
pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$
37713770
type: string
37723771
uri:

charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3765,7 +3765,6 @@ spec:
37653765
description: |-
37663766
Duration is a string value representing a duration in time. The format is as specified
37673767
in GEP-2257, a strict subset of the syntax parsed by Golang time.ParseDuration.
3768-
format: duration
37693768
pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$
37703769
type: string
37713770
uri:

internal/ir/xds.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,17 +1082,6 @@ type RemoteJWKS struct {
10821082
CacheDuration *gwapiv1.Duration `json:"cacheDuration,omitempty"`
10831083
}
10841084

1085-
// JwksAsyncFetch is used to Fetch Jwks asynchronously in the main thread before the listener is activated.
1086-
//
1087-
// +k8s:deepcopy-gen=true
1088-
type JwksAsyncFetch struct {
1089-
// If false, the listener is activated after the initial fetch is completed. The initial fetch result can be either successful or failed.
1090-
// If true, it is activated without waiting for the initial fetch to complete.
1091-
FastListener bool `json:"fastListener,omitempty"`
1092-
// The duration to refetch after a failed fetch.
1093-
FailedRefetchDuration *metav1.Duration `json:"failedRefetchDuration,omitempty"`
1094-
}
1095-
10961085
// OIDC defines the schema for authenticating HTTP requests using
10971086
// OpenID Connect (OIDC).
10981087
//

internal/ir/zz_generated.deepcopy.go

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/xds/translator/jwt.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"google.golang.org/protobuf/types/known/durationpb"
2121
"google.golang.org/protobuf/types/known/emptypb"
2222
"k8s.io/utils/ptr"
23-
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
2423

2524
egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
2625
"github.com/envoyproxy/gateway/internal/ir"
@@ -151,16 +150,6 @@ func buildJWTAuthn(irListener *ir.HTTPListener) (*jwtauthnv3.JwtAuthentication,
151150
jwksCluster = cluster.name
152151
}
153152

154-
var duration *gwapiv1.Duration
155-
if jwks.CacheDuration != nil {
156-
duration = jwks.CacheDuration
157-
}
158-
159-
timeDuration, err := time.ParseDuration(string(*duration))
160-
if err != nil {
161-
return nil, err
162-
}
163-
164153
remote := &jwtauthnv3.JwtProvider_RemoteJwks{
165154
RemoteJwks: &jwtauthnv3.RemoteJwks{
166155
HttpUri: &corev3.HttpUri{
@@ -171,11 +160,16 @@ func buildJWTAuthn(irListener *ir.HTTPListener) (*jwtauthnv3.JwtAuthentication,
171160
Timeout: durationpb.New(defaultExtServiceRequestTimeout),
172161
},
173162

174-
CacheDuration: durationpb.New(timeDuration),
175-
AsyncFetch: &jwtauthnv3.JwksAsyncFetch{},
163+
AsyncFetch: &jwtauthnv3.JwksAsyncFetch{},
176164
},
177165
}
178-
166+
if jwks.CacheDuration != nil {
167+
cDur, err := time.ParseDuration(string(*jwks.CacheDuration))
168+
if err != nil {
169+
return nil, err
170+
}
171+
remote.RemoteJwks.CacheDuration = durationpb.New(cDur)
172+
}
179173
// Set the retry policy if it exists.
180174
if jwks.Traffic != nil && jwks.Traffic.Retry != nil {
181175
var rp *corev3.RetryPolicy

0 commit comments

Comments
 (0)