Skip to content

Commit 799e1c8

Browse files
sanposhihoxtineskim
authored andcommitted
fix: allow the header based session persistence not to have AbsoluteTimeout (kubernetes-sigs#3215)
1 parent 6a6f72e commit 799e1c8

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

apis/v1/shared_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ const (
745745
)
746746

747747
// SessionPersistence defines the desired state of SessionPersistence.
748-
// +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)"
748+
// +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)"
749749
type SessionPersistence struct {
750750
// SessionName defines the name of the persistent session token
751751
// which may be reflected in the cookie or the header. Users

config/crd/experimental/gateway.networking.k8s.io_backendlbpolicies.yaml

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

config/crd/experimental/gateway.networking.k8s.io_grpcroutes.yaml

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

config/crd/experimental/gateway.networking.k8s.io_httproutes.yaml

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

geps/gep-1619/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ type BackendLBPolicySpec struct {
487487

488488
// SessionPersistence defines the desired state of
489489
// SessionPersistence.
490-
// +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"
490+
// +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)"
491491
type SessionPersistence struct {
492492
// SessionName defines the name of the persistent session token
493493
// which may be reflected in the cookie or the header. Users

pkg/test/cel/backendlbpolicy_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ func TestBackendLBPolicyConfig(t *testing.T) {
8080
},
8181
wantErrors: []string{},
8282
},
83+
{
84+
name: "valid BackendLBPolicyConfig header-based session persistence",
85+
sessionPersistence: gatewayv1a2.SessionPersistence{
86+
SessionName: ptrTo("foo"),
87+
Type: ptrTo(gatewayv1.HeaderBasedSessionPersistence),
88+
},
89+
wantErrors: []string{},
90+
},
8391
}
8492
for _, tc := range tests {
8593
t.Run(tc.name, func(t *testing.T) {

0 commit comments

Comments
 (0)