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

GEP-1713: ListenerSets - Standard Mechanism to Merge Gateway Listeners (rev 2) #3213

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

dprotaso
Copy link
Contributor

@dprotaso dprotaso commented Jul 23, 2024

This replaces #1863
What type of PR is this?

/kind gep

What this PR does / why we need it:

Outlines a mechanism to merge Gateway Listeners

Which issue(s) this PR fixes:

Fixes #1713

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added kind/gep PRs related to Gateway Enhancement Proposal(GEP) do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jul 23, 2024
Copy link
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a few comments here, thanks for keeping working on pushing this forward.

geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work on this @dprotaso!

geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
Copy link
Contributor

@youngnick youngnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM for Provisional (or maybe even Implementable, since we'll need to implement it and try it out) now.

@robscott
Copy link
Member

robscott commented Aug 2, 2024

Status update: We're at the end of the 2-day extension for this GEP to make it into this release, so unfortunately I think this is going to have to switch to targeting v1.3. Fortunately, this new shorter release cycle means that's actually not that far away.

Ultimately, I think you're right. For this to make sense, we'd need some structural changes to Gateway, particularly making Listeners optional. That's a huge change to a GA API (even if it would initially be limited to experimental channel, breaking changes to something labeled as "v1"can be confusing). Combined with the huge scope of the PR, and most of the feedback just coming from Nick and I, I think this particular GEP would benefit from some more soak time for additional reviewers + to smooth out any areas we're uncertain. Unfortunately, I think it's just too big to try to squeeze in today.

With that said, I would like to see this GEP make it in early in the next release cycle (similar to how named Route rules just barely missed the previous cycle but was merged at the beginning of this one).

I think it would be useful to do the following between now and then:

  1. Continue to iterate on this GEP, discussing in meetings as necessary (this can include merging this as provisional with some unresolved sections and iterating in smaller PRs)
  2. Build out a clearer vision for how this can be expanded to cover more use cases in the future (particularly the ones we discussed in the hierarchy doc) - that will help make a stronger case for why this is important
  3. Present these ideas at the SIG-Network review session for v1.2 so we can get early feedback on this overall idea and adjust the proposal accordingly
  4. Warn all controller authors that it's possible that Listeners may become optional in a future release of Gateway API and they should make sure they can handle that case

Thanks again for all the work you've been putting in to push this forward @dprotaso! I really do appreciate it.

@shaneutt shaneutt added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Sep 18, 2024
@shaneutt shaneutt added this to the v1.3.0 milestone Sep 18, 2024
@dprotaso dprotaso changed the title GEP-1713: Standard Mechanism to Gateway Merge Listeners (rev 2) GEP-1713: Standard Mechanism to Merge Gateway Listeners (rev 2) Nov 12, 2024
@dprotaso dprotaso changed the title GEP-1713: Standard Mechanism to Merge Gateway Listeners (rev 2) GEP-1713: ListenerSets - Standard Mechanism to Merge Gateway Listeners (rev 2) Nov 25, 2024
@dprotaso
Copy link
Contributor Author

dprotaso commented Dec 9, 2024

/retest

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work on this @dprotaso! Took a fresh pass and I think this largely makes sense.

geps/gep-1713/index.md Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
geps/gep-1713/index.md Outdated Show resolved Hide resolved
Comment on lines +462 to +464
> 1. Should we have made it easier to leave port empty or do port ranges?
> 2. Should we support multiple hostnames?
> 3. Are there any validations that we wish we'd tightened up?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for capturing this!

+1 to past me on all points 🙃. I'd argue that we should probably make attempts at resolving both 1 and 2 here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For multiple hostnames, I can see the utility, but it risks making the rules about Listener -> Route hostname matching even more complicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional port would be nice - then let the implementation choose it. Though it's a rare use case for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My votes on the above:

  1. Yes
  2. No
  3. Not that I can think of

geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
protocol: HTTP
port: 80
---
apiVersion: gateway.networking.k8s.io/v1alpha1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to get some resolution on #3497 before we release this API, as I'd prefer to switch this group to gateway.networking.x-k8s.io

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although we can certainly revisit this in the API phase, I think I can safely say that a majority of maintainers are in favor of using the new experimental API group for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can safely say that a majority of maintainers are in favor of using the new experimental API group for this.

The discussion #3497 seems to be leaning the other way - was there a meeting/vote somewhere?

}
// ListenerEntry embodies the concept of a logical endpoint where a Gateway accepts
// network connections.
type ListenerEntry struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's been some renewed interest in pushing L4 + ClusterIP Gateways forward, and one thing that could help with that is if Listeners could point directly to backends. I'd personally like to explore that in this GEP as a follow up to the similar idea in the doc. (No need to take action here until we get some more comments/feedback on this idea).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that including L4 considerations at the very first stage of the design, before having the actual API in place is too much of a stretch. Getting rid of L4 routes in favor of including L4 routing information (i.e., backends) is a controversial one (for which I am on the fence honestly) and I don't think that should block this GEP which has been in the work for a long time and needs to be moved forward.

Putting here L4 will likely require a lot of discussion, partially off-topic with the broader goal of this GEP.

@youngnick
Copy link
Contributor

Reading back over this, I think the main things outstanding are:

@robscott
Copy link
Member

I'm strongly in favor of this, and the idea seems to be gaining some traction on the corresponding issue.

  • Will we make port optional in the ListenerSet version of Listener?

I would like to ensure that this has a well documented path forward to supporting all ports on a single Listener. That could either be a port range or an empty port. We don't have to start with either of those, I'd just like to have a documented plan for how we could get there.

  • Will we keep the parentRef as a list or move it back to a singular one?

I'm on the fence on this one, left a comment above.

@mikemorris
Copy link
Contributor

I would like to ensure that this has a well documented path forward to supporting all ports on a single Listener.

Could make sense to align with NetPol conventions on this (omitting an optional port field implies all), refs kubernetes-sigs/network-policy-api#247 (comment)

@dprotaso
Copy link
Contributor Author

I was thinking an empty port could be allow the implementation to pick a random port. Though I realize now we could also accomplish that by relaxing our constraints on PortNumber and allowing 0 (unix semantics). If we do that then I don't particularly need an optional port - so I'm curious about other people's use cases.

I think use of port in netpol is fundamentally different than that of a listener - eg. firewall rules semantics (no port == all) vs listener semantics (0 port = wildcard)

geps/gep-1713/index.md Outdated Show resolved Hide resolved
geps/gep-1713/index.md Show resolved Hide resolved
}
// ListenerEntry embodies the concept of a logical endpoint where a Gateway accepts
// network connections.
type ListenerEntry struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that including L4 considerations at the very first stage of the design, before having the actual API in place is too much of a stretch. Getting rid of L4 routes in favor of including L4 routing information (i.e., backends) is a controversial one (for which I am on the fence honestly) and I don't think that should block this GEP which has been in the work for a long time and needs to be moved forward.

Putting here L4 will likely require a lot of discussion, partially off-topic with the broader goal of this GEP.

Valid reasons for `Accepted` being `False` are:

- `NotAllowed` - the `parentRef` doesn't allow attachment
- `ParentNotAccepted` - the `parentRef` isn't accepted (eg. invalid address)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling to understand what this reason means: is it about the Accepted condition of the referenced parent? If that's the case, we are setting here a cross-object dependency. What should we use here if the parent doesn't exist at all (problem raised by the ResolvedRefs condition)?

Copy link
Contributor Author

@dprotaso dprotaso Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm struggling to understand what this reason means: is it about the Accepted condition of the referenced parent?

Yeah - if the ListenerSet tries to attach to a parent Gateway - but that Gateway has Accepted=False

If that's the case, we are setting here a cross-object dependency.

There is a cross object dependency because we expect ListenerSet to have a ParentRef

What should we use here if the parent doesn't exist at all (problem raised by the ResolvedRefs condition)?

hmm... ResolvedRefs condition on *Route seems to only apply to the backend and not parentRefs. Unless we want to make sweeping changes then I'd suggest in your scenario just set Accepted=False with a message that the parent X doesn't exist

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend copying the Route conditions here since they should be the ~same:

RouteConditionAccepted RouteConditionType = "Accepted"
// This reason is used with the "Accepted" condition when the Route has been
// accepted by the Gateway.
RouteReasonAccepted RouteConditionReason = "Accepted"
// This reason is used with the "Accepted" condition when the route has not
// been accepted by a Gateway because the Gateway has no Listener whose
// allowedRoutes criteria permit the route
RouteReasonNotAllowedByListeners RouteConditionReason = "NotAllowedByListeners"
// This reason is used with the "Accepted" condition when the Gateway has no
// compatible Listeners whose Hostname matches the route
RouteReasonNoMatchingListenerHostname RouteConditionReason = "NoMatchingListenerHostname"
// This reason is used with the "Accepted" condition when there are
// no matching Parents. In the case of Gateways, this can occur when
// a Route ParentRef specifies a Port and/or SectionName that does not
// match any Listeners in the Gateway.
RouteReasonNoMatchingParent RouteConditionReason = "NoMatchingParent"
// This reason is used with the "Accepted" condition when a value for an Enum
// is not recognized.
RouteReasonUnsupportedValue RouteConditionReason = "UnsupportedValue"
// This reason is used with the "Accepted" when a controller has not yet
// reconciled the route.
RouteReasonPending RouteConditionReason = "Pending"
// This reason is used with the "Accepted" condition when there
// are incompatible filters present on a route rule (for example if
// the URLRewrite and RequestRedirect are both present on an HTTPRoute).
RouteReasonIncompatibleFilters RouteConditionReason = "IncompatibleFilters"
)

We don't currently require or suggest that implementations populate Route status if the parent is not accepted, and I think that's sensible. If an implementation isn't accepting the parent resource, why would it try to reconcile all of the children of that resource?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dprotaso
Once this PR has been reviewed and has the lgtm label, please assign mlavacca for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/gep PRs related to Gateway Enhancement Proposal(GEP) priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

GEP: Standard Mechanism to Merge Multiple Gateways
10 participants