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 (kubernetes-sigs#3221)

Co-authored-by: Kensei Nakada <handbomusic@gmail.com>
  • Loading branch information
k8s-infra-cherrypick-robot and sanposhiho authored Jul 29, 2024
1 parent 95cc90d commit 4d0cf60
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 4d0cf60

Please sign in to comment.