Skip to content

feat: optimize memory and apiserver use#504

Open
jmclong wants to merge 1 commit into
mainfrom
dev/jlong/optimize-mem-apiserver
Open

feat: optimize memory and apiserver use#504
jmclong wants to merge 1 commit into
mainfrom
dev/jlong/optimize-mem-apiserver

Conversation

@jmclong

@jmclong jmclong commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces several improvements and refactorings to the CSI driver, focusing on simplifying event recording, improving cache configuration, and cleaning up event emission logic. The most significant changes include refactoring how the driver's Pod is referenced for event logging, updating cache and client options for better performance and correctness, and removing unnecessary or redundant event emissions in the LVM code.

Refactoring event subject and context:

  • The driver's Pod is now constructed at startup from downward-API environment variables and passed explicitly to components that need it, rather than being fetched from the API server. This simplifies event emission and ensures that events are always associated with the correct Pod. (cmd/driver/main.go, internal/csi/controller/controller.go, internal/csi/core/lvm/startup.go) [1] [2] [3] [4] [5] [6] [7]

Kubernetes cache and client configuration:

  • The controller-runtime manager's cache and client options are updated to use TransformStripManagedFields and to disable caching for certain objects (like CSIDriver and Node), improving efficiency and correctness. (cmd/driver/main.go, cmd/manager/main.go) [1] [2]

LVM event emission cleanup:

  • Several event emissions related to provisioning and deleting logical volumes and volume groups are removed to reduce noise and redundancy. Only essential events (such as failures or empty volume creation) are now emitted. (internal/csi/core/lvm/lvm.go, internal/csi/core/lvm/controller.go) [1] [2] [3] [4] [5] [6] [7]

Pod UID propagation and downward-API usage:

  • The DaemonSet YAML and driver startup logic now propagate the Pod UID via environment variable and command-line argument, enabling accurate Pod object construction for event emission. (charts/latest/templates/daemonset.yaml, cmd/driver/main.go) [1] [2] [3] [4] [5]

Resource limits adjustment:

  • The memory limit for the manager is increased from 128Mi to 500Mi to accommodate higher resource usage. (charts/latest/values.yaml)

// If it does not exist, we can return success without deleting the volume
// since the PV cleanup controller will handle finalizer removal.
if err := cs.k8sClient.Get(ctx, client.ObjectKey{Name: selectedNode}, &corev1.Node{}); err != nil {
// TODO(jlong): move cleanup to csi-manager to avoid PartialObjectMetadata GET in driver
@jmclong jmclong force-pushed the dev/jlong/optimize-mem-apiserver branch from c8e8683 to cb4fd59 Compare June 8, 2026 18:43
@jmclong jmclong force-pushed the dev/jlong/optimize-mem-apiserver branch from cb4fd59 to 9b35ac5 Compare June 8, 2026 20:09
@jmclong jmclong marked this pull request as ready for review June 8, 2026 21:02
@jmclong jmclong requested review from a team, croomes and landreasyan as code owners June 8, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants