external-dns icon indicating copy to clipboard operation
external-dns copied to clipboard

Gateway HTTPRoute doesn't matched hosts with different number of parts

Open sergeyshevch opened this issue 10 months ago • 5 comments

What happened:

https://github.com/kubernetes-sigs/external-dns/blob/master/source/gateway.go#L507 On this line checked the same amount of domain parts, but for Gateway API spec it doesn't required

For example, I have: HttpRoute with hostname - env.dev.company.domain And Gateway with hostname - *.company.domain

External DNS controller will ignore such route but it's valid on Gateway side

What you expected to happen:

Domain matched, DNS record created

How to reproduce it (as minimally and precisely as possible):

Gateway:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: rest-external
spec:
  gatewayClassName: cilium
  listeners:
    - allowedRoutes:
        namespaces:
          from: All
      hostname: '*.example.com'
      name: web-gw
      port: 443
      protocol: HTTP

Route:

apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: route
spec:
  hostnames:
    - mr1.dev.example.com
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: rest-external
  rules:
    - backendRefs:
        - group: ""
          kind: Service
          name: svcname
          port: 8080
          weight: 1
      matches:
        - path:
            type: PathPrefix
            value: /

Anything else we need to know?:

Environment:

  • External-DNS version (use external-dns --version): v20230529-v0.13.5
  • DNS provider: Route53
  • Others: Gateway controller - Cilium

sergeyshevch avatar Aug 17 '23 09:08 sergeyshevch