-
Notifications
You must be signed in to change notification settings - Fork 301
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
BackendConfig support for session affinity #526
Conversation
Allow user provided session affinity type and ttl. Sending e2e/fuzz tests on a distinct PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work!
TimeoutSec *int64 `json:"timeoutSec,omitempty"` | ||
ConnectionDraining *ConnectionDrainingConfig `json:"connectionDraining,omitempty"` | ||
AffinityCookieTtlSec *int64 `json:"affinityCookieTtlSec,omitempty"` | ||
SessionAffinity string `json:"sessionAffinity,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we encapsulate these settings in a struct? Something like this:
type SessionAffinityConfig struct {
SessionAffinityType string
AffinityCookieTtlSec *int64
}
pkg/backends/features/affinity.go
Outdated
|
||
// Should we check if specified SessionAffinity is among the currently GCP supported values? | ||
// For now let's forward as is to GCP, to inherit API error message (and evolutions). | ||
// Same for TTL (should be in 0-86400 range). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add this validation to pkg/backendconfig/validation.go?
That way, we can give feedback to the user before the LB starts to get created.
/ok-to-test |
pkg/backendconfig/validation.go
Outdated
|
||
if beConfig.Spec.SessionAffinity.AffinityType != "" { | ||
if _, ok := supportedAffinities[beConfig.Spec.SessionAffinity.AffinityType]; !ok { | ||
return fmt.Errorf("unsupported AffinityType: %s, sould be one of NONE, CLIENT_IP, or GENERATED_COOKIE", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should
pkg/backendconfig/validation.go
Outdated
|
||
if beConfig.Spec.SessionAffinity.AffinityCookieTtlSec != nil { | ||
if *beConfig.Spec.SessionAffinity.AffinityCookieTtlSec < 0 || *beConfig.Spec.SessionAffinity.AffinityCookieTtlSec > 86400 { | ||
return fmt.Errorf("unsupported AffinityCookieTtlSec: %d, should be comprised between 0 and 86400", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this word
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bpineau, rramkumar1 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Allow user provided session affinity type and ttl.
Sending e2e/fuzz tests on a distinct PR.