Skip to content

Commit

Permalink
csi: use job status not alloc status for plugin updates from summary
Browse files Browse the repository at this point in the history
When an allocation is updated, the job summary for the associated job
is also updated. CSI uses the job summary to set the expected count
for controller and node plugins. We incorrectly used the allocation's
server status instead of the job status when deciding whether to
update or remove the job from the plugins. This caused a node drain or
other terminal state for an allocation to clear the expected count for
the entire plugin.

Use the job status to guide whether to update or remove the expected
count.
  • Loading branch information
tgross committed Feb 8, 2022
1 parent 127a824 commit 6e545d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nomad/state/state_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5127,7 +5127,9 @@ func (s *StateStore) updatePluginWithJobSummary(index uint64, summary *structs.J
plug = plug.Copy()
}

plug.UpdateExpectedWithJob(alloc.Job, summary, alloc.ServerTerminalStatus())
plug.UpdateExpectedWithJob(alloc.Job, summary,
alloc.Job.Status == structs.JobStatusDead)

err = updateOrGCPlugin(index, txn, plug)
if err != nil {
return err
Expand Down

0 comments on commit 6e545d4

Please sign in to comment.