Skip to content

Commit 8e325ad

Browse files
committed
Make the behavior on route attachement explicit
1 parent ac0dfec commit 8e325ad

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed

geps/gep-1713/index.md

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,79 @@ spec:
515515
sectionName: foo
516516
```
517517

518-
#### Optional Section Name
518+
#### Gateway parents and sectionName
519519

520-
If a `sectionName` in a Route's `parentRef` is not set then the Route MUST attach to only the listeners in the referenced parent. As an example given a `Gateway` and it's child `ListenerSets` a route attaching to the `Gateway` with an empty `sectionName` shall only attach to the listeners in the `Gateways` immediate `spec.listeners` list. In other words, the Route will not attach to any listeners in the `ListenerSets`. This is necessary because, for UX reasons, the `name` field does not have to be unique across all Listeners merged into a Gateway (see the section below for details).
520+
If a `sectionName` in a Route's `parentRef` is not set then the Route MUST attach to only the listeners in the referenced parent. As an example given a `Gateway` and it's child `ListenerSets` a route attaching to the `Gateway` with an empty `sectionName` shall only attach to the listeners in the `Gateways` immediate `spec.listeners` list.
521+
522+
In other words, the Route MUST attach just to the Gateway listeners specified on `.spec.listeners` and MUST NOT not attach to any listeners in the child `ListenerSets`
523+
of the `Gateway`.
524+
525+
This is necessary because, for UX reasons, the `name` field does not have to be unique across all Listeners merged into a Gateway (see the section below for details).
526+
527+
The following manifest exemplifies this situation:
528+
529+
```yaml
530+
apiVersion: gateway.networking.k8s.io/v1
531+
kind: Gateway
532+
metadata:
533+
name: parent-gateway
534+
spec:
535+
gatewayClassName: example
536+
allowedListeners:
537+
namespaces:
538+
from: Same
539+
listeners:
540+
- name: foo2
541+
hostname: foo.com
542+
protocol: HTTP
543+
port: 80
544+
- name: foo3
545+
hostname: foo1.com
546+
protocol: HTTP
547+
port: 80
548+
---
549+
apiVersion: gateway.networking.x-k8s.io/v1alpha1
550+
kind: ListenerSet
551+
metadata:
552+
name: first-workload-listeners
553+
spec:
554+
parentRef:
555+
name: parent-gateway
556+
kind: Gateway
557+
group: gateway.networking.k8s.io
558+
listeners:
559+
- name: foo
560+
hostname: first.foo.com
561+
protocol: HTTP
562+
port: 80
563+
---
564+
apiVersion: gateway.networking.k8s.io/v1
565+
kind: HTTPRoute
566+
metadata:
567+
name: httproute-example
568+
spec:
569+
parentRefs:
570+
# No SectionName is set on this parentRef
571+
- name: some-workload-listeners
572+
kind: Gateway
573+
```
574+
575+
The example above SHOULD be attached only to the following listeners:
576+
```yaml
577+
apiVersion: gateway.networking.k8s.io/v1
578+
kind: Gateway
579+
.....
580+
spec:
581+
listeners:
582+
- name: foo
583+
hostname: foo.com
584+
protocol: HTTP
585+
port: 80
586+
- name: foo1
587+
hostname: foo1.com
588+
protocol: HTTP
589+
port: 80
590+
```
521591

522592
### Policy Attachment
523593

0 commit comments

Comments
 (0)