solo-io / gloo

The Cloud-Native API Gateway and AI Gateway
https://docs.solo.io/
Apache License 2.0
4.1k stars 446 forks source link

Gloo Gateway API CRs should report when they are orphans #10276

Open nmnellis opened 1 week ago

nmnellis commented 1 week ago

Gloo Edge Product

Enterprise

Gloo Edge Version

v1.17.x

Is your feature request related to a problem? Please describe.

When following the hello world example https://docs.solo.io/gateway/latest/quickstart/ i misconfigured the parent reference on the HTTPRoute so that the name did not match the gateway. All logging and statuses or lack there of made it seem like Gloo was happy with the configuration but in reality it did nothing. We should report when you have orphaned objects or bad references.

kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: http
spec:
  gatewayClassName: gloo-gateway
  listeners:
  - protocol: HTTP
    port: 8080
    name: http
    allowedRoutes:
      namespaces:
        from: All
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: httpbin
  namespace: httpbin
  labels:
    example: httpbin-route
spec:
  parentRefs:
    - name: http-does-not-exist
      namespace: gloo-system
  hostnames:
    - "www.example.com"
  rules:
    - backendRefs:
        - name: httpbin
          port: 8000

This was caught by gwctl

    - HTTPRoute.gateway.networking.k8s.io/httpbin/httpbin: HTTPRoute(.gateway.networking.k8s.io) "httpbin/httpbin" references a non-existent Gateway(.gateway.networking.k8s.io) "gloo-system/http-does-not-exist":

Describe the solution you'd like

Adding a status to Gloo objects that are clearly not being used or have mis configurations. You should know that the parent reference you are making selects nothing.

Describe alternatives you've considered

No response

Additional Context

No response

lgadban commented 6 days ago

This needs design before implementing a custom status on a GW API type

Internal slack discussion for more context: https://solo-io-corp.slack.com/archives/C07077NS0NP/p1730743410857859