-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate ControllerUnpublish calls #587
Comments
Thinking out loud. The external attacher currently does not have any internal state about a VolumeAttachment. At step 3. above, it only sees the VolumeAttachment object and it can be indistinguishable from VolumeAttachment that failed attach with a non-final error + the attacher failed to save the error to VolumeAttachment. Its Pod was deleted and the volume should be detached now. The attacher should call ControllerUnpublish to make sure a pending ControllerPublish is cancelled and the volume is detached in the end.
|
Another ideas:
|
There is a race in the external-attacher that can cause
ControllerUnpublish
to be called twice.Scenario:
DeletionTimestamp
ControllerUnpublish
, gets success from the CSI driver. The attacher marks the VolumeAttachmentStatus
as detached and removes attacher's finalizer. Notice two PATCH calls are needed:external-attacher/pkg/controller/util.go
Lines 82 to 106 in 8e7b49f
ControllerUnpublish
again.If lucky enough, the CSI driver is idempotent, returns success and the attacher tries to mark the VolumeAattachment as detached + tries to remove the finalizer. This usually fails, because the VolumeAttachment gets deleted in the API server.
Logs, the first detach:
Second detach:
All this is relatively harmless, just some CSI drivers don't like to be called multiple times. For example, while vsphere-csi-driver is idempotent, it calls CnsClient.DetachVolume() on every
ControllerUnpublish
. It only checks its error code to ensure idempotency. The failedDetachVolume
call is then visible in list of tasks as failed in vCenter and vSphere admins may get an alert.The text was updated successfully, but these errors were encountered: