Skip to content

Conversation

@black-dragon74
Copy link
Member

This PR aims to optimize memory consumption and allocation for csi-addons controller. This goal is achieved mainly by:

  • Disabling cache for resources that we do not need frequently.
  • Setting up shared informers on every resource that we Get/List frequently (VAs / PVs)
  • A new simplified PVC controller without the overheads that came with old way of operation, mainly:
    • Supports and enabled only when schedule-precedence is set to storageclass.
    • Uses deterministic naming for resources to avoid manual housekeeping of stale resources**
    • Ditches the extra field indexers on created resources (side-effect of above)
    • No update operations on PVCs, state-to-reconcile is always calculated with SC as source of truth.
  • A little housekeeping by moving common functions/variables into their own controller/utils package.

Closes: #815


** We need to consider the (non-deterministic) resources that will be already present on the cluster. That part is still WIP (hence the DNM) and I am open to suggestions.

This patch moves the variables and functions common across
controllers into its own `utils` package.

The related tests have been moved as well.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
This patch adds a new controller for PVC objects which differs from
existing controller in the following main ways:

- Only supports annotations on StorageClasses
- Sets us a silent watch on PV objects to optimize lookups.
- Uses deterministic naming for child resources to avoid manual house
  keeping.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
when SchedulePrecedence is set to `StorageClass`

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
This patch adds a silent watch on VolumeAttachment objects
to avoid unexpected memory consumption due to `List` calls.

It is okay to setup a watch in two places as the Informer is shared
and managed by the Manager.

Signed-off-by: Niraj Yadav <niryadav@redhat.com>
@Madhu-1
Copy link
Member

Madhu-1 commented Nov 24, 2025

@black-dragon74 can you please share the result of the memory optimization after this change?

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

Labels

DNM Do Not Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize memory footprint of csi-addons

2 participants