-
Notifications
You must be signed in to change notification settings - Fork 585
Improve some ListenetSet gep descriptions #3978
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rikatz 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 |
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!
One extra question I have on ListenerSet that is not clear for me, is the deduplication of listeners from different namespaces. Let me add an example: apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: parent-gateway
namespace: infra
spec:
allowedListeners:
namespaces:
from: All
---
apiVersion: gateway.networking.x-k8s.io/v1alpha1
kind: ListenerSet
metadata:
name: listener01
namespace: user01
spec:
parentRef:
name: parent-gateway
namespace: infra
kind: Gateway
group: gateway.networking.k8s.io
listeners:
- name: something
hostname: something.foo.com
protocol: HTTPS
port: 443
tls:
mode: Terminate
certificateRefs:
- kind: Secret
group: ""
name: cert
---
apiVersion: gateway.networking.x-k8s.io/v1alpha1
kind: ListenerSet
metadata:
name: listener01
namespace: user02
spec:
parentRef:
name: parent-gateway
namespace: infra
kind: Gateway
group: gateway.networking.k8s.io
listeners:
- name: something
hostname: something.foo.com
protocol: HTTPS
port: 443
tls:
mode: Terminate
certificateRefs:
- kind: Secret
group: ""
name: othercert Who owns |
on ListenerSet conflict management: at some point on this GEP there is a mention to it:
This is the statement for conflict management, but it is not really clear on what a conflict means. This way, during a discussion on gateway-api channel, we've reached the consensus of writing some conflict examples and how to deal with them, as part of the GEP, to make it easier on implementation and conformance. |
Thanks @rikatz. To bring the comments I had in the Slack thread here: I think there should be two rules:
Examples that illustrate those rules would be awesome. |
@youngnick added some examples and a whole section for conflict management, let me know wdyt :) |
Thanks for clearing it up @dprotaso |
So, it seems clear that the current GEP does not make the behavior clear for when a HTTPRoute attaches directly to a Gateway that has or could have ListenerSets attached. We have two main options here:
To me, it seems like Option 1 has some pros and cons:
For Option 2:
We've also discussed possibly making Listeners in a Gateway optional in the future, and requiring only one of Listeners and AllowedListeners to be set - which would make this problem less of an issue, although we would still need to define what happens in the case that a HTTPRoute with no sectionName attaches to a Gateway with AllowedListeners. In that case:
After writing all that out, I think I am slightly in favor of option 1 - keeping what we have now - mainly because it would also be very easy to end up making a Route that attached to hundreds or thousands of Listeners, which would be difficult to impossible to reflect in the Route's status. I should note that, whatever option we choose, we MUST put some explicit explanation of the behavior in the GEP updates. |
doing now, passing through the comments again |
I second @youngnick and prefer option 1. |
So now after reading all of the comments: IMO we should always prioritize the most restrictive approach in favor of security/avoiding leaks (which seems option 1 for me as well) I can imagine the following situation (forget about classes, internal vs external loadbalancers, let's think on a very simple scenario):
I have a personal preference that the behavior should be explicit:
As Nick pointed at some point here, I guess I would expect in the future that we transition to something that is more "user centric" without removing the "power" of a cluster admin:
I don't know if all of this makes sense, thinking loud on how we should try to rely ListenerSet to avoid some common problems like:
|
@youngnick @dprotaso I think this is the last missing piece for this update? If so, I will work on making this statement explicit on the GEP review, sounds good? |
Yes, I think that's fine. I think that we are stuck with ListenerSet also defining a |
The GEP already has a section called Optional Section Name that states:
I will make it more explicit and containing some examples so it clarifies the current situation of a Gateway without a sectionName and attached ListenerSet |
927d5f8
to
8e325ad
Compare
my last commit contains the changes to make the behavior more explicit, please let me know if this is adequate now |
geps/gep-1713/index.md
Outdated
For instance, the following `HTTPRoute` attempts to attach to a listener defined in the parent `Gateway` using the sectionName `foo`, which also exists on a ListenerSet. | ||
This is not valid and the route's status `Accepted` condition should be set to `False` |
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 this be the case now that routes are not inherited ?
If the kind is not specified, it can default to the gateway listener, but if the kind is ListenerSet
, then it can attach to the listenerset listener
Asking since section names don't need to be unique between gateway / listenersets
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.
hum, @dprotaso I need your thoughts here
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.
Actually, that HTTPRoute should, as written, fail to attach, because the kind
is Gateway
, not ListenerSet
(and that really should be, for now, XListenerSet
, here and everywhere else).
Assuming that the Kind is corrected, then I actually don't think this should be an error on the HTTPRoute, because there is only one Listener it could attach to.
Now that we've clarified that there's no Listener attachment across parentRefs, then we can make the "can this attach" rule a bit simpler by saying "When a Route tries to attach to a Listener using a sectionName
, then that sectionName
must be distinct _within that Listener group (which could be a Gateway or a ListenerSet)." I think the situation shouldn't arise because listener.name
should also be distinct within a Listener group, but it's good to be specific, I think.
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.
Assuming that the Kind is corrected, then I actually don't think this should be an error on the HTTPRoute, because there is only one Listener it could attach to.
Agreed - it should attach to the listener defined in the parentref (either gateway or listenerset) and if a listener with that name does not exist, it should follow the default behaviour of erroring out
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.
so, echoing as a manifest because I understand yaml better than people :P
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: parent-gateway
spec:
gatewayClassName: example
allowedListeners:
namespaces:
from: Same
listeners:
- name: foo
hostname: foo.com
protocol: HTTP
port: 80
- name: foo
hostname: foo1.com
protocol: HTTP
port: 80
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httproute-example
spec:
parentRefs:
- name: parent-gateway
kind: Gateway
sectionName: foo
But isn't this the case already? Don't we have a conflict management already in place for it, that does not allow two liteners on a listenergroup to have the same name?
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.
Yes, that's what I meant by saying "this situation should not arise".
It's probably good to have the behavior specified anyway, because I think it clarifies the overall intent better.
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.
But yes, that YAML should not work, because name
can't be repeated across Listeners.
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.
yeah ok, I see the point now. The idea is be explicit like "if a ListenerSet has a sectionName, and gateway not, but you say the parentRef is a gateway and try to use the ListenerSet sectionName this should fail"
I have fixed the example, and I hope everything is ready to roll now
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.
I feel like we should have the Kind listed as XListenerSet
everywhere in this doc, with a note in the API section that this prefix is for during the experimental period.
Then, when we graduate this to Standard, we can remove the X prefix everywhere, and remove the API section note.
As it stands, since folks will need to use XListenerSet
for the actual objects, and this will be a major source of examples, it feels like we could end up with user confusion if we don't make this super clear.
Once those two outstanding things are resolved, this LGTM. |
ba348af
to
a7dd8ef
Compare
One last comment on this route disambiguation, just so I can be sure on the statement. @youngnick @davidjumani if this is not right, and if you have some time I would appreciate if you can provide an example of a yaml/manifest with what you mean :) Thanks! |
Yes, this LGTM now. Thanks @rikatz! |
/hold cancel |
What type of PR is this?
/kind gep
What this PR does / why we need it:
This PR is a review of ListenerSet GEP, fixing some manifests and adding some comments to be further discussed
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: