-
Notifications
You must be signed in to change notification settings - Fork 787
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
Fix context handling in WaitForVolumeAttachment & add in-flight checks to attachment/detachment operations #1621
Conversation
/retest |
2ebbb80
to
62c5510
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
…s to attachment/detachment operations Signed-off-by: Eddie Torres <torredil@amazon.com>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ConnorJC3 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What is this PR about? / Why do we need it?
cloud.go
changes:This PR addresses incorrect handling of the Context in
WaitForAttachmentState
which implements a retry mechanism using exponential backoff to wait for an attachment to reach the expected state via theDescribeVolumesWithContext
API.The context is used to carry deadlines and cancellation signals across API boundaries. When polling for volume state, its possible for the context to be cancelled due to timeout etc. If this happens while we're waiting for the volume to reach the expected state, it is desirable to stop waiting and immediately return an error to the caller. This change allows us to better handle cases where the context is cancelled or reaches its deadline by stopping execution when no longer necessary.
controller.go
changes:Added in-flight checks to both
ControllerPublishVolume
andControllerUnpublishVolume
. The in-flight check acts as a synchronization mechanism by providing mutual exclusion to ensure idempotency.Testing changes:
Added tests to validate code paths and logic when attaching / detaching volumes. Also did some refactoring to move towards table-driven tests which vastly improves readability and maintainability of these tests.
What testing is done?
With this patch:
Without this patch: