contour icon indicating copy to clipboard operation
contour copied to clipboard

HTTPRoute conflicts when specifying a fallback https listener

Open hatsuyuki15 opened this issue 7 months ago • 3 comments

What steps did you take and what happened:

Given the following gateway:

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: contour
  namespace: projectcontour
spec:
  gatewayClassName: contour
  listeners:
    - name: http
      protocol: HTTP
      port: 80
      allowedRoutes:
        namespaces:
          from: All

    - name: https-example.com
      protocol: HTTPS
      port: 443
      hostname: "*.example.com"
      allowedRoutes:
        namespaces:
          from: All
      tls:
        certificateRefs:
          - name: "wildcard-example.com-tls"
            kind: Secret

    - name: https
      protocol: HTTPS
      port: 443
      allowedRoutes:
        namespaces:
          from: All
      tls:
        certificateRefs:
          - name: "default-tls"
            kind: Secret

HTTPRoute:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: example.com
spec:
  hostnames:
    - "*.example.com"
  rules:
    - backendRefs:
        - name: example
          port: 8080
          kind: Service
  parentRefs:
    - name: contour
      group: gateway.networking.k8s.io
      namespace: projectcontour
      kind: Gateway

Applying the HTTPRoute above will always result in HTTPRoute's Match has conflict with other HTTPRoute's Match error. If I remove either https-example.com or https listener, it will work again. The above HTTPRoute is the only route in the system (there is no other route to cause conflict)

What did you expect to happen:

The HTTPRoute should be accepted.

Anything else you would like to add: It seems like the HTTPRoute is attached to both https-example.com and https listener. Each attachment is treated by contour as a separated HTTPRoute, which will lead to conflict.

Environment:

  • Contour version: 1.29.1
  • Kubernetes version: (use kubectl version): v1.27.13
  • Kubernetes installer & version:
  • Cloud provider or hardware configuration: GKE. Node version: v1.26.14
  • OS (e.g. from /etc/os-release):

hatsuyuki15 avatar Jul 10 '24 13:07 hatsuyuki15