Repository navigation
GEP-1619: Refactor SessionPersistence to discriminated union pattern - #4873
kubernetes-prow[bot] merged 1 commit into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gcs278 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
fd750bb to
88643f0
Compare
| // Support: Extended | ||
| // | ||
| // +optional | ||
| Name *HeaderName `json:"name,omitempty"` |
There was a problem hiding this comment.
Some additional documentation for why this can be omitted (cloud load balancer constraints?) and the behavior of implementations if it is omitted would be helpful.
There was a problem hiding this comment.
Good call - added docs for what happens when the field is omitted from a user perspective (+optional).
From an implementation perspective, this is Extended because some implementations hardcode the cookie name (GKE hardcodes to "GSSA", Contour hardcodes to X-Contour-Session-Affinity). I'll add details to the GEP. Let me know if you think it should also be in the API doc comments.
There was a problem hiding this comment.
Let me know if you think it should also be in the API doc comments.
I think this would be useful to document mostly for implementations to better understand whether they should support this field, and if they support it but it's omitted how they should handle that situation. Possibly worth using the <gateway:util:excludeFromCRD> tag for any implementer-specific guidance not necessary for users of the API.
There was a problem hiding this comment.
@mikemorris updated. Sorry for the delay. Originally held off for my GEP housekeeping PR #4870, but realized there's no dependency between them.
| // Support: Extended | ||
| // | ||
| // +optional | ||
| Name *HeaderName `json:"name,omitempty"` |
There was a problem hiding this comment.
Similar question as Cookie.Name, why is this field optional and what is the expected behavior if omitted?
There was a problem hiding this comment.
Good point. I think that header.name should actually be required since the client needs to know the header name to include it in subsequent requests. Unlike cookies, headers aren't automatically handled by the browser. Also, all prior art for header persistence has the header name as required too - so it feels safe.
Updated it to be +required.
977b30d to
f8aa06b
Compare
f8aa06b to
91c2916
Compare
f544ed8 to
32cb398
Compare
|
@mikemorris I'm ready for review again when you get a chance - thanks for the initial review. |
|
Since this PR already reshapes The route-level guidance derives Fine to keep this PR focused; happy to open a follow-up for the |
It's related to these changes, but I vote to keep it as a follow up. I'm trying to keep my PRs limited in size to keep things moving. It seems like we quite low on reviewer bandwidth right now too. But the good news is with the shift to
Yea please feel free to help drive this forward and open a follow up PR. I could also use reviews on this PR as well - so feel free to help with that. Sorry I've gotten a bit stuck on other things, but Session Persistence need to start moving again. Ping @mikemorris @rikatz @youngnick for another review here when you get a chance, thanks! |
|
I think that this looks good overall, but has some things that still need work. I'll approve, and we can iterate and wait for LGTM, then unhold. /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gcs278, youngnick, zhaohuabing The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
35498a7 to
650b0a5
Compare
|
@rikatz @youngnick ready for another review. I would like to point out that this is a breaking experimental change. There will be churn for 3 implementations (nginx-gateway-fabric, envoy gateway, and kgateway). I get this is unfortunately painful, but the reason experimental exists The alternative would be to "freeze" the current type definitions and defer all breaking changes to a new struct targeted for Backend, but that's pretty messy. |
650b0a5 to
2e3948d
Compare
|
this one lgtm @mikemorris @youngnick can we move forward? |
| The cookie name is configured via the `cookie.name` field (Extended support). Not all implementations support | ||
| configuring the cookie name. For example, GKE's stateful generated cookie | ||
| ([GSSA](https://pkg.go.dev/github.com/GoogleCloudPlatform/gke-gateway-api/apis/networking/v1)) uses a fixed cookie | ||
| name that cannot be changed by the user. If `cookie.name` is not specified, a unique cookie name will be generated. |
There was a problem hiding this comment.
| name that cannot be changed by the user. If `cookie.name` is not specified, a unique cookie name will be generated. | |
| name that cannot be changed by the user. If `cookie.name` is not specified, a unique cookie name SHOULD be generated. |
It sounds like not all implementations (such as GKE described in the sentence before) may generate a unique cookie name?
There was a problem hiding this comment.
Good point - updated. SHOULD seems right because it's extended and not all implementation support name. Though, I guess we could make it MUST when it's implemented. Made it SHOULD for now.
|
/lgtm Tiny nit on cookie name language. I do want to ensure #5046 (changing default cookie path and adding explicit |
2e3948d to
db053a4
Compare
Move sessionName into type-specific configs (cookie.name / header.name), rename cookieConfig to cookie, and add HeaderConfig struct. Change session name support level from Implementation-specific to Extended. This aligns with the union discriminator pattern and with prior art from dataplanes and implementations. NOTE: This is a breaking change to the experimental API.
db053a4 to
2c9cfd3
Compare
|
@mikemorris fixed your suggestions. Will need re-lgtm. I will work on getting #5046 in good shape to land soon. BTW - do you mean an official release (1.6.z or 1.7.0)? or a monthly experimental when you say "same release". |
|
Ah forgot that distinction - mostly concerned that the default path change doesn't land after some other part of this reaches standard, idk if it might make sense to include some mention of the expected upcoming default changes in release notes for implementer awareness, but yea less concerned with monthly experimental releases. /lgtm |
|
/unhold |
What type of PR is this?
/kind gep
What this PR does / why we need it
What
Refactors the SessionPersistence API to use the discriminated union pattern, split out from #4649 to land independently. This is a breaking change to the experimental API.
sessionNamefield and move naming into type-specific configs (cookie.name/header.name)cookieConfigto cookie to match the union discriminator conventionHeaderConfigstruct with required name field for header-based persistencecookie.namesupport level from Implementation-specific to Extended;header.nameis Core and requiredHeaderNameand use it forGRPCHeaderName,HTTPHeaderNameandQueryParamMatchName#1796) for both cookie and header name fields, adding RFC token character validation+unionDiscriminatormarker on Type fieldWhy
sessionName is misleading. The field name suggests a server-side session identifier, but every implementation uses it as the literal cookie or header name on the wire.
cookie.name/header.namemakes this clear. Every major dataplane and cloud LB models session naming as separate fields per type.Implementation-specific blocks conformance testing. The current support level means implementations can interpret
sessionNamehowever they want, making conformance tests impossible. Changing to Extended enables standardizing cookie sharing semantics and validating cookie name conflicts (Clarify sessionPersistence scoping and conflict resolution across HTTPRoutes and Backends #4268). The original motivation for Implementation-specific was to accommodate cloud LBs that can't control the cookie name, but Extended achieves the same goal (implementations can opt out) while enabling conformance testing.Name belongs to the mechanism, not the concept. You can say "the cookie name is X" or "the header name is X", but not "the session persistence name is X." Pushing the name into type-specific configs groups it with the other attributes of that mechanism.
Which issue(s) this PR fixes:
Fixes # N/A
This addresses concern was raised in #4268 about ambiguities
Does this PR introduce a user-facing change?: