Skip to content
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

fix: allow the header based session persistence not to have AbsoluteTimeout #3215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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