kubernetes/pkg/controller/volume
Jean-Francois Remy f1717baaaa Fix nodes volumesAttached status not updated
The UpdateNodeStatuses code stops too early in case there is
an error when calling updateNodeStatus. It will return immediately
which means any remaining node won't have its update status put back
to true.

Looking at the call sites for UpdateNodeStatuses, it appears this is
not the only issue. If the lister call fails with anything but a Not Found
error, it's silently ignored which is wrong in the detach path.
Also the reconciler detach path calls UpdateNodeStatuses but the real intent
is to only update the node currently processed in the loop and not proceed
with the detach call if there is an error updating that specifi node volumesAttached
property. With the current implementation, it will not proceed if there is
an error updating another node (which is not completely bad but not ideal) and
worse it will proceed if there is a lister error on that node which means the
node volumesAttached property won't have been updated.

To fix those issues, introduce the following changes:
- [node_status_updater] introduce UpdateNodeStatusForNode which does what
  UpdateNodeStatuses does but only for the provided node
- [node_status_updater] if the node lister call fails for anything but a Not
  Found error, we will return an error, not ignore it
- [node_status_updater] if the update of a node volumesAttached properties fails
  we continue processing the other nodes
- [actual_state_of_world] introduce GetVolumesToReportAttachedForNode which
  does what GetVolumesToReportAttached but for the node whose name is provided
  it returns a bool which indicates if the node in question needs an update as
  well as the volumesAttached list. It is used by UpdateNodeStatusForNode
- [actual_state_of_world] use write lock in updateNodeStatusUpdateNeeded, we're
  modifying the map content
- [reconciler] use UpdateNodeStatusForNode in the detach loop
2022-02-22 12:20:53 -08:00
..
attachdetach Fix nodes volumesAttached status not updated 2022-02-22 12:20:53 -08:00
common generic ephemeral volume: graduation to GA 2021-10-11 20:54:20 +02:00
ephemeral Check in OWNERS modified by update-yamlfmt.sh 2021-12-09 21:31:26 -05:00
events hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
expand Merge pull request #106853 from gnufied/disable-exp-backoff-volume-not-inuse 2021-12-22 19:46:37 -08:00
persistentvolume Merge pull request #107559 from liggitt/invalid-selectors 2022-01-19 14:49:31 -08:00
protectionutil hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
pvcprotection Remove StorageObjectInUseProtection feature gate logic 2021-11-03 00:13:50 +03:00
pvprotection Remove StorageObjectInUseProtection feature gate logic 2021-11-03 00:13:50 +03:00
OWNERS Check in OWNERS modified by update-yamlfmt.sh 2021-12-09 21:31:26 -05:00