Closed
Description
Describe the bug
NGINX Kubernetes Gateway doesn't try to attach to a listener if an HTTPRoute has 0 hostnames.
To Reproduce
Steps to reproduce the behavior:
HTTPRoute:
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: coffee
spec:
parentRefs:
- name: gateway
sectionName: http
rules:
- matches:
- path:
type: PathPrefix
value: /coffee
backendRefs:
- name: coffee
port: 80
In the status of the HTTPRoute, NKG reports:
Status:
Parents:
Conditions:
Last Transition Time: 2023-05-03T15:55:08Z
Message: Listener hostname does not match the HTTPRoute hostnames
Observed Generation: 1
Reason: NoMatchingListenerHostname
Status: False
Type: Accepted
Controller Name: k8s-gateway.nginx.org/nginx-gateway-controller
Parent Ref:
Group: gateway.networking.k8s.io
Kind: Gateway
Name: gateway
Namespace: default
Section Name: http
Expected behavior
- HTTPRoute attaches to a listener
- Traffic (in this example) -
curl <any-host>/coffee
routes to coffee service
Additional context
Conformance tests often don't include hostnames in HTTPRoutes. Example -- https://github.com/kubernetes-sigs/gateway-api/blob/v0.6.2/conformance/tests/httproute-matching.yaml