kubernetes icon indicating copy to clipboard operation
kubernetes copied to clipboard

scheduler: Improve CSILimits plugin accuracy by using VolumeAttachments

Open torredil opened this issue 4 months ago • 14 comments

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR fixes a bug in the CSILimits scheduler plugin where volumes from deleted pods are not being counted, which results in over-scheduling.

The bug occurs because when a pod is deleted, its volumes are no longer considered in the current scheduling logic, but VolumeAttachments may still exist (which more accurately represent the actual state of attachments).

Which issue(s) this PR fixes:

Fixes https://github.com/kubernetes/kubernetes/issues/126502

Note for Reviewers

A volume is considered "fully detached" once the associated VolumeAttachment object is deleted from the API server: https://github.com/kubernetes/kubernetes/blob/4aeaf1e99e82da8334c0d6dddd848a194cd44b4f/pkg/volume/csi/csi_attacher.go#L444-L447

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

N/A

torredil avatar Sep 30 '24 13:09 torredil