Skip to content

Route status conditions are emitted in non-deterministic order, causing unnecessary status updates #10182

Closed

Description

@kkk777-7

Description:
While working on #10180, I found that when a route parent has errors of more than one condition type (e.g. ResolvedRefs and BackendsAvailable), the order of those conditions in the route status changes between translations.

Example (one rule with a valid backendRef, a backendRef without ready endpoints, and a non-existent Service):

# translation A
conditions:
- type: BackendsAvailable   # EndpointsNotFound
- type: ResolvedRefs        # BackendNotFound
# translation B
conditions:
- type: ResolvedRefs
- type: BackendsAvailable

Root cause:

TypedErrorCollector groups errors in a map, and Types() / GetAllErrors() return them in map iteration order (internal/gatewayapi/status/error.go). Route conditions are reset and rebuilt on every translation, so the error-derived conditions are appended in random order.

Nothing on the way to the API server normalizes the order:

  • The watchable map only skips notifying subscribers when the new value is reflect.DeepEqual to the previous one, and that comparison is order-sensitive.
  • The provider replaces the whole RouteParentStatus (mergeRouteParentStatus).
  • isStatusEqual uses cmp.Equal, which only ignores LastTransitionTime and is also order-sensitive, so a reordered status is treated as changed and written with Status().Update().

Impact:
For affected routes, any re-translation (e.g. triggered by an unrelated resource change in the same GatewayClass) can cause: unnecessary status writes to the API server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions