Skip to content

Stale listener condition present in Gateway for a non-existing Listener #773

@chauhanshubham

Description

@chauhanshubham

Description:
Following the reproduction steps, it is seen that the Gateway is left with a stale listener condition, for a listener
that no longer exists.

Repro steps:

  1. apply examples/kubernetes/quickstart.yaml - ensure that Gateway has proper Status conditions, with 1 listener condition
    showing attachedRoutes: 1.
  2. Add another listener in the gateway, for the listener spec to look something like this
listeners:
- allowedRoutes:
     namespaces:
       from: Same
     name: http
     port: 8080
     protocol: HTTP
- allowedRoutes:
     namespaces:
       from: Same
     name: http2
     port: 8081
     protocol: HTTP 

This should create 2 listener conditions, both specifying attachedRoutes: 1.
3. Remove the single HTTPRoute that was created by the quickstart.yaml. Both existing listener conditions are updated correctly, specifying attachedRoutes: 0.
4. Re-apply the quickstart.yaml which will "recreate" the HTTPRoute, and "update" the Gateway to have only one listener.
5. The bug is that - in the Gateway status still shows the stale listener Condition corresponding to listener http2 with attachedRoutes: 0
The spec and status thus looks like this

 spec:
    gatewayClassName: eg
    listeners:
    - allowedRoutes:
        namespaces:
          from: Same
      name: http
      port: 8080
      protocol: HTTP
  status:
    ....
    conditions:
    ....
    listeners:
    - attachedRoutes: 1
      conditions:
      - lastTransitionTime: "2022-12-03T06:58:58Z"
        message: Listener is ready
        observedGeneration: 3
        reason: Ready
        status: "True"
        type: Ready
      name: http
      supportedKinds:
      - group: gateway.networking.k8s.io
        kind: HTTPRoute
    - attachedRoutes: 0
      conditions:
      - lastTransitionTime: "2022-12-03T06:58:48Z"
        message: Listener is ready
        observedGeneration: 2
        reason: Ready
        status: "True"
        type: Ready
      name: http2
      supportedKinds:
      - group: gateway.networking.k8s.io
        kind: HTTPRoute

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomerskind/bugSomething isn't workingpriority/mediumLabel used to express the "medium" priority level

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions