Currently, the CPU allocations in the drive is not atomic. If PrepareResourceClaims calls were to run concurrently, two claims could both read the CPU allocation store and write overlapping CPU assignments.
However, this is not an immediate issue because the kubelet currently serializes all PrepareResourceClaims calls by default, and we do not modify this in the driver code (kubeletOpts). In the future, if we decide to disable serialization and support concurrent calls (by setting kubeletplugin.Serialize(false)), we will need to introduce synchronization mechanisms in pkg/driver/dra_hooks.go.
Kubelet code for reference:
- The serialization default is enabled here
- The serial lock is acquired here before calling
PrepareResourceClaims.
Currently, the CPU allocations in the drive is not atomic. If
PrepareResourceClaimscalls were to run concurrently, two claims could both read the CPU allocation store and write overlapping CPU assignments.However, this is not an immediate issue because the kubelet currently serializes all PrepareResourceClaims calls by default, and we do not modify this in the driver code (kubeletOpts). In the future, if we decide to disable serialization and support concurrent calls (by setting kubeletplugin.Serialize(false)), we will need to introduce synchronization mechanisms in
pkg/driver/dra_hooks.go.Kubelet code for reference:
PrepareResourceClaims.