kubernetes-sigs / gateway-api

Repository for the next iteration of composite service (e.g. Ingress) and load balancing APIs.
https://gateway-api.sigs.k8s.io
Apache License 2.0
1.86k stars 482 forks source link

[Enhancement Request] Specify Explicit Controller when `HTTPRoute` backend is a `Service` #3444

Open DerekTBrown opened 2 weeks ago

DerekTBrown commented 2 weeks ago

What would you like to be added:

HTTPRoute needs a way of explicitly specifying the controllerNames that should be responsible for implementing the route when parentRef is not a Gateway.

I propose this be added to the parentRef schema:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-app-1
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: http-app
    port: 8080
    controllers:
       - "istio.io/gateway-controller"

Alternatively, an annotation could be made on the Service resource to indicate the controller owner.

Why this is needed:

  1. Users can define HTTPRoutes that use Service as a parentRef (for instance, Istio).
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: http-app-1
spec:
  parentRefs:
  - group: ""
    kind: Service
    name: http-app
    port: 8080
  hostnames:
  - "http-app.my-namespace.svc.cluster.local"
  rules:
  - backendRefs:
    - name: http-app-stable
      port: 8080
      weight: 90
    - name: http-app-stable
      port: 8080
      weight: 10
  1. Users might have multiple controllers capable of implementing this HTTPRoute.

  2. This can lead to conflicts between controllers, that clobber owners references, statuses, etc.

howardjohn commented 2 weeks ago

Doesn't the status already include a "controller" field to distinguish multiple controllers writing a status about the same parent?