Skip to content

Claim reconcile lists every IPAddress, and every unbound claim is requeued on any address or class event #8

Open

Description

Found in the architectural review of community#35 (cozystack/community#35 (review)).

What happens

Two paths in internal/controller/ipaddressclaim_controller.go scale with the size of the ledger rather than with the claim being reconciled:

  • bindAvailableAddress lists every IPAddress in the cluster on each reconcile of an unbound claim (r.List(ctx, list) with no field selector, around line 327). A field index exists only for claimRef (indexes.go).
  • unboundClaims lists every IPAddressClaim and enqueues all unbound ones on any IPAddress or IPAddressClass event (claimsForAddress, claimsForClass, lines 437–460). One address becoming Available therefore reconciles every pending claim of every class, and each of those lists the ledger again.

When it matters

Fine at hundreds of objects. At around 10k addresses and a few hundred pending claims, one release event produces a few hundred full ledger lists from the informer cache in quick succession.

Suggested fix

  • Index IPAddress by class and phase (and family), and have bindAvailableAddress query Available addresses of the claim's class only.
  • In claimsForAddress, enqueue only unbound claims whose resolved class matches the address's class (a second index on status.className). In claimsForClass, enqueue only claims of that class and claims with an empty className.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions