-
Notifications
You must be signed in to change notification settings - Fork 581
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 |
@@ -59,7 +59,7 @@ type GatewaySpec struct { | |||
} | |||
|
|||
type AllowedListeners struct { | |||
// +kubebuilder:default={from:Same} | |||
// +kubebuilder:default={from: None} |
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.
this was made to reflect the current implementation
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 may be out of context, wdym here? are we moving away from the Same as default?
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.
on the API definition Same is not the default, None is:
gateway-api/apis/v1/gateway_types.go
Line 306 in fb75360
// +kubebuilder:default={from: None} |
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!
@@ -59,7 +59,7 @@ type GatewaySpec struct { | |||
} | |||
|
|||
type AllowedListeners struct { | |||
// +kubebuilder:default={from:Same} | |||
// +kubebuilder:default={from: None} |
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 may be out of context, wdym here? are we moving away from the Same as default?
|
||
To attach to listeners in both a `Gateway` and `ListenerSet` the route MUST have two `parentRefs`: | ||
```yaml | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: httproute-example | ||
spec: | ||
parentRefs: | ||
- name: some-workload-listeners | ||
- name: second-workload-listeners | ||
kind: ListenerSet | ||
sectionName: second | ||
- name: parent-gateway | ||
kind: Gateway | ||
sectionName: foo | ||
``` | ||
|
||
To attach to listeners in both a `Gateway` and `ListenerSet` the route MUST have two `parentRefs`: | ||
For instance, the following `HTTPRoute` attempts to attach to a listener defined in the parent `Gateway` using the sectionName `foo`. This is not valid and the route's status `Accepted` condition should be set to `False` | ||
|
||
```yaml | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: httproute-example | ||
spec: | ||
parentRefs: | ||
- name: second-workload-listeners | ||
kind: ListenerSet | ||
sectionName: second | ||
- name: parent-gateway | ||
- name: some-workload-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.
I guess no real change here, just order, right?
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.
right, I wrote on my self review why I did the change. The example of the attachment of Gateway AND ListenerSet is more clear on this order, then we can go to the invalid examples :)
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.
To make this invalid the kind
needs to be a ListenerSet
in the parentRef
kind: Gateway | ||
sectionName: foo | ||
``` | ||
>--- Ricardo - above is a bit confusing, maybe ask Dave some clarification |
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.
/cc @dprotaso
```yaml | ||
apiVersion: gateway.networking.k8s.io/v1 | ||
kind: Gateway | ||
metadata: | ||
name: parent-gateway | ||
spec: | ||
gatewayClassName: example | ||
allowedListeners: |
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.
per the api spec, not having an allowedListener means "None" which would make this invalid, so I am fixing the example for at least same namespace
@@ -417,7 +424,8 @@ metadata: | |||
name: parent-gateway | |||
spec: | |||
allowedListeners: | |||
- from: Same | |||
namespaces: |
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.
allowedListeners is not an array, so changing here to reflect the current implemented API
@@ -438,35 +446,38 @@ spec: | |||
sectionName: second | |||
``` | |||
|
|||
For instance, the following `HTTPRoute` attempts to attach to a listener defined in the parent `Gateway` using the sectionName `foo`. This is not valid and the route's status `Accepted` condition should be set to `False` | |||
|
|||
To attach to listeners in both a `Gateway` and `ListenerSet` the route MUST have two `parentRefs`: |
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 have changed the order of examples here to make it clear what means using two parentRefs, before the next example which is an invalid example
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.
Reading this now it is a duplicate of Routes MUST be able to attach to a
ListenerSetand it's parent
Gatewayby having multiple
parentRefs eg:
I saw we replace the above yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: httproute-example
spec:
parentRefs:
- name: second-workload-listeners
kind: ListenerSet
sectionName: second
with the yaml containing two parent refs
kind: Gateway | ||
sectionName: foo | ||
``` | ||
>--- Ricardo - above is a bit confusing, maybe ask Dave some clarification |
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.
@dprotaso the example above is a bit confusing for me, probably because the API changed from when it was implemented.
I was wondering what it means for an HTTPRoute to try to attach a listener defined on a Gateway, using a section name foo
. If this section name exists on the Gateway it is valid, right? eg.:
listeners:
- name: foo
port: 80
protocol: HTTP
So how can the situation above be invalid? Maybe we can get the full yaml definition, with Gateway, ListenerSet and HTTPRoute for clarification here?
Thanks!
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.
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 :) |
@@ -115,6 +115,16 @@ type ListenerSetSpec struct { | |||
// 2. ListenerSet ordered by creation time (oldest first) | |||
// 3. ListenerSet ordered alphabetically by “{namespace}/{name}”. | |||
// | |||
// Regarding Conflict Management, Listeners in a ListenerSet follow the same |
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 we add this new clause to the API types godoc?
Also we might want to call out sectionName behaves a bit differently where sibling ListenerSets can have the same sectionName.
hostname: www.something.tld | ||
protocol: HTTPS | ||
port: 443 | ||
tls: |
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.
The following example shows a `Gateway` with an HTTP listener and two child HTTPS `ListenerSets` with unique hostnames and certificates. | ||
|
||
Only `ListenerSets` from the same namespace of the `Gateway` will be accepted: |
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.
The following example shows a `Gateway` with an HTTP listener and two child HTTPS `ListenerSets` with unique hostnames and certificates. | |
Only `ListenerSets` from the same namespace of the `Gateway` will be accepted: | |
The following example shows a `Gateway` with an HTTP listener and two child HTTPS `ListenerSets` with unique hostnames and certificates. Only `ListenerSets` from the same namespace of the `Gateway` will be accepted: |
Conflicts are covered in the section 'ListenerConditions within a ListenerSet' | ||
Conflicts are covered in the section [Listener and ListenerSet conflicts](#listener-and-listenerset-conflicts) | ||
|
||
### Listener and ListenerSet conflicts |
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.
We should combine this section into ListenerConditions within a ListenerSet
so that conflicts are covered in one section.
management. | ||
|
||
With ListenerSet this validation should happen within the same ListenerSet resource, | ||
but MUST be validated also within a Gateway scope and all of the attached Listeners/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.
this language needs to exclude sectionName when comparing it across sibling 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.
Or refer to 'Optional Section Name'
hostname: www.something.tld | ||
protocol: HTTPS | ||
port: 443 | ||
conditions: |
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.
using a tab here instead of spaces
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.
There's a bunch of these places - just view the GitHub rendering of the GEP and you'll see broken syntax formatting
``` | ||
|
||
The ListenerSet `user-listenerset` should be marked as Conflicted, as the `parent-gateway` | ||
have a listener definition called `foo` that conflicts with the ListenetSet definition |
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.
have a listener definition called `foo` that conflicts with the ListenetSet definition | |
The ListenerSet `user-listenerset` should be marked as Conflicted, as the `parent-gateway` | |
has a listener definition called `foo` that conflicts with the ListenerSet definition | |
called `myapp`, as the following: |
Can we also update this (the paragraph not the condition message) to highlight that it is a conflict because the host name is the same but they use different termination TLS certificates
protocol: HTTPS | ||
port: 443 | ||
conditions: | ||
- message: ListenerSet has conflicts with Gateway 'infra/parent-gateway' |
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.
Would we want to highlight the listener name in the error message?
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?: