1 Commits

Author SHA1 Message Date
Tim Gross
c8c67da52d CSI: allow plugin GC to detect jobs with updated plugin IDs (#20555)
When a job that implements a plugin is updated to have a new plugin ID, the old
version of the plugin is never deleted. We want to delay deleting plugins until
garbage collection to avoid race conditions between a plugin being registered
and its allocations being marked healthy.

Add logic to the state store's `DeleteCSIPlugin` method (used only by GC) to
check whether any of the jobs associated with the plugin have no allocations and
either have been purged or have been updated to no longer implement that plugin
ID.

This changeset also updates the CSI plugin lifecycle tests in the state store to
use `shoenig/test` over `testify`, and removes a spurious error log that was
happening on every periodic plugin GC attempt.

Fixes: https://github.com/hashicorp/nomad/issues/20225
2024-05-16 10:29:07 -04:00