Skip to content

Commit

Permalink
fix: allow the header based session persistence not to have AbsoluteT…
Browse files Browse the repository at this point in the history
…imeout
  • Loading branch information
sanposhiho committed Jul 24, 2024
1 parent 86c06a0 commit d46ae46
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apis/v1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ const (
)

// SessionPersistence defines the desired state of SessionPersistence.
// +kubebuilder:validation:XValidation:message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent",rule="!has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)"
// +kubebuilder:validation:XValidation:message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent",rule="!has(self.cookieConfig) || !has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)"
type SessionPersistence struct {
// SessionName defines the name of the persistent session token
// which may be reflected in the cookie or the header. Users
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion geps/gep-1619/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ type BackendLBPolicySpec struct {

// SessionPersistence defines the desired state of
// SessionPersistence.
// +kubebuilder:validation:XValidation:rule="!has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)",message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent"
// +kubebuilder:validation:XValidation:message="AbsoluteTimeout must be specified when cookie lifetimeType is Permanent",rule="!has(self.cookieConfig) || !has(self.cookieConfig.lifetimeType) || self.cookieConfig.lifetimeType != 'Permanent' || has(self.absoluteTimeout)"
type SessionPersistence struct {
// SessionName defines the name of the persistent session token
// which may be reflected in the cookie or the header. Users
Expand Down
8 changes: 8 additions & 0 deletions pkg/test/cel/backendlbpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func TestBackendLBPolicyConfig(t *testing.T) {
},
wantErrors: []string{},
},
{
name: "valid BackendLBPolicyConfig header-based session persistence",
sessionPersistence: gatewayv1a2.SessionPersistence{
SessionName: ptrTo("foo"),
Type: ptrTo(gatewayv1.HeaderBasedSessionPersistence),
},
wantErrors: []string{},
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
Expand Down

0 comments on commit d46ae46

Please sign in to comment.