Skip to content

withdrawAssociations lists every IPAddress on each Service deletion #7

Open

Description

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

What happens

withdrawAssociations in internal/controller/service_controller.go (around line 250) lists every IPAddress in the cluster on each Service deletion and scans the list for entries whose status.associatedTo names the deleted Service.

When it matters

Service deletions are frequent and unrelated to this driver in most cases. At around 10k ledger entries every Service deletion anywhere in the cluster costs a full scan from the cache.

Suggested fix

Add a field index on IPAddress keyed by status.associatedTo (namespace/name, kind Service) and query it, as the core already does for claimRef. Alternatively, skip the lookup for Services that never carried the driver's pinned marker, which covers the common case before any index.

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