open-nomad/nomad/volumewatcher
Tim Gross 759310d13a
CSI: volume watcher shutdown fixes (#12439)
The volume watcher design was based on deploymentwatcher and drainer,
but has an important difference: we don't want to maintain a goroutine
for the lifetime of the volume. So we stop the volumewatcher goroutine
for a volume when that volume has no more claims to free. But the
shutdown races with updates on the parent goroutine, and it's possible
to drop updates. Fortunately these updates are picked up on the next
core GC job, but we're most likely to hit this race when we're
replacing an allocation and that's the time we least want to wait.

Wait until the volume has "settled" before stopping this goroutine so
that the race between shutdown and the parent goroutine sending on
`<-updateCh` is pushed to after the window we most care about quick
freeing of claims.

* Fixes a resource leak when volumewatchers are no longer needed. The
  volume is nil and can't ever be started again, so the volume's
  `watcher` should be removed from the top-level `Watcher`.

* De-flakes the GC job test: the test throws an error because the
  claimed node doesn't exist and is unreachable. This flaked instead of
  failed because we didn't correctly wait for the first pass through the
  volumewatcher.

  Make the GC job wait for the volumewatcher to reach the quiescent
  timeout window state before running the GC eval under test, so that
  we're sure the GC job's work isn't being picked up by processing one
  of the earlier claims. Update the claims used so that we're sure the
  GC pass won't hit a node unpublish error.

* Adds trace logging to unpublish operations
2022-04-04 10:46:45 -04:00
..
interfaces.go csi: update volumewatcher to use unpublish RPC (#8579) 2020-08-06 14:31:18 -04:00
interfaces_test.go csi: fix mocked modes in volumewatcher test (#12104) 2022-02-23 09:51:20 -05:00
volume_watcher.go CSI: volume watcher shutdown fixes (#12439) 2022-04-04 10:46:45 -04:00
volume_watcher_test.go ci: swap ci parallelization for unconstrained gomaxprocs 2022-03-15 12:58:52 -05:00
volumes_watcher.go CSI: volume watcher shutdown fixes (#12439) 2022-04-04 10:46:45 -04:00
volumes_watcher_test.go CSI: volume watcher shutdown fixes (#12439) 2022-04-04 10:46:45 -04:00