Skip to content

Commit 40b93de

Browse files
committed
feat(gateway) add support for gateway api experimental ListenerSet
1 parent fe23feb commit 40b93de

File tree

8 files changed

+410
-31
lines changed

8 files changed

+410
-31
lines changed

charts/external-dns/templates/clusterrole.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ rules:
6565
- apiGroups: ["gateway.networking.k8s.io"]
6666
resources: ["gateways"]
6767
verbs: ["get","watch","list"]
68+
- apiGroups: ["gateway.networking.x-k8s.io"]
69+
resources: ["xlistenersets"]
70+
verbs: ["get","watch","list"]
6871
{{- end }}
6972
{{- if not .Values.namespaced }}
7073
- apiGroups: [""]
@@ -158,6 +161,9 @@ rules:
158161
- apiGroups: ["gateway.networking.k8s.io"]
159162
resources: ["gateways"]
160163
verbs: ["get","watch","list"]
164+
- apiGroups: ["gateway.networking.x-k8s.io"]
165+
resources: ["xlistenersets"]
166+
verbs: ["get","watch","list"]
161167
{{- end }}
162168
{{- end }}
163169
{{- end }}

docs/flags.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
| `--[no-]exclude-unschedulable` | Exclude nodes that are considered unschedulable (default: true) |
3333
| `--[no-]expose-internal-ipv6` | When using the node source, expose internal IPv6 addresses (optional, default: false) |
3434
| `--fqdn-template=""` | A templated string that's used to generate DNS names from sources that don't define a hostname themselves, or to add a hostname suffix when paired with the fake source (optional). Accepts comma separated list for multiple global FQDN. |
35+
| `--[no-]gateway-enable-experimental` | Enable Gateway API experimental (gateway.networking.x-k8s.io) resources (currently only XListenerSet support for routes) |
3536
| `--gateway-label-filter=""` | Filter Gateways of Route endpoints via label selector (default: all gateways) |
3637
| `--gateway-name=""` | Limit Gateways of Route endpoints to a specific name (default: all names) |
3738
| `--gateway-namespace=""` | Limit Gateways of Route endpoints to a specific namespace (default: all namespaces) |

docs/sources/gateway-api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ spec:
202202
- --source=gateway-tlsroute
203203
- --source=gateway-tcproute
204204
- --source=gateway-udproute
205+
# Optionally, enable Gateway API Experimental resource support (XListenerSet)
206+
- --gateway-enable-experimental
205207
# Optionally, limit Routes to those in the given namespace.
206208
- --namespace=my-route-namespace
207209
# Optionally, limit Routes to those matching the given label selector.

docs/sources/gateway.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
The gateway-grpcroute, gateway-httproute, gateway-tcproute, gateway-tlsroute, and gateway-udproute
44
sources create DNS entries based on their respective `gateway.networking.k8s.io` resources.
55

6+
## Gateway experimental support
7+
8+
Optionally, [ListenerSet](https://gateway-api.sigs.k8s.io/geps/gep-1713) support can be enabled
9+
with the flag `--gateway-enable-experimental`. In this case, the `xlistenerset.gateway.networking.x-k8s.io`
10+
resource listener entries will be appended to the `gateway.networking.k8s.io` listeners.
11+
612
## Filtering the Routes considered
713

814
These sources support the `--label-filter` flag, which filters \*Route resources
@@ -46,6 +52,9 @@ Matching Gateways are discovered by iterating over the \*Route's `status.parents
4652
- If the `--gateway-name` flag was specified, ignores parents with a `parentRef.name` other than the
4753
specified value.
4854

55+
- When [experimental](#gateway-experimental-support) support is enabled the Gateway is expanded from
56+
the `parentRef` of the `XListenerSet`.
57+
4958
For example, given the following HTTPRoute:
5059

5160
```yaml

pkg/apis/externaldns/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type Config struct {
6060
IgnoreIngressRulesSpec bool
6161
ListenEndpointEvents bool
6262
ExposeInternalIPV6 bool
63+
GatewayEnableExperimental bool
6364
GatewayName string
6465
GatewayNamespace string
6566
GatewayLabelFilter string
@@ -288,6 +289,7 @@ var defaultConfig = &Config{
288289
ExoscaleAPIZone: "ch-gva-2",
289290
ExposeInternalIPV6: false,
290291
FQDNTemplate: "",
292+
GatewayEnableExperimental: false,
291293
GatewayLabelFilter: "",
292294
GatewayName: "",
293295
GatewayNamespace: "",
@@ -626,6 +628,7 @@ func bindFlags(b FlagBinder, cfg *Config) {
626628
b.BoolVar("exclude-unschedulable", "Exclude nodes that are considered unschedulable (default: true)", defaultConfig.ExcludeUnschedulable, &cfg.ExcludeUnschedulable)
627629
b.BoolVar("expose-internal-ipv6", "When using the node source, expose internal IPv6 addresses (optional, default: false)", false, &cfg.ExposeInternalIPV6)
628630
b.StringVar("fqdn-template", "A templated string that's used to generate DNS names from sources that don't define a hostname themselves, or to add a hostname suffix when paired with the fake source (optional). Accepts comma separated list for multiple global FQDN.", defaultConfig.FQDNTemplate, &cfg.FQDNTemplate)
631+
b.BoolVar("gateway-enable-experimental", "Enable Gateway API experimental (gateway.networking.x-k8s.io) resources (currently only XListenerSet support for routes)", defaultConfig.GatewayEnableExperimental, &cfg.GatewayEnableExperimental)
629632
b.StringVar("gateway-label-filter", "Filter Gateways of Route endpoints via label selector (default: all gateways)", defaultConfig.GatewayLabelFilter, &cfg.GatewayLabelFilter)
630633
b.StringVar("gateway-name", "Limit Gateways of Route endpoints to a specific name (default: all names)", defaultConfig.GatewayName, &cfg.GatewayName)
631634
b.StringVar("gateway-namespace", "Limit Gateways of Route endpoints to a specific namespace (default: all namespaces)", defaultConfig.GatewayNamespace, &cfg.GatewayNamespace)

0 commit comments

Comments
 (0)