Skip to content
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

Backport of CSI: reorder controller volume detachment into release/1.2.x #12700

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #12387 to be assessed for backporting due to the inclusion of the label backport/1.2.x.

The below text is copied from the body of the original PR.


Ran into this while working on #12384

In #12112 and #12113 we solved for the problem of races in releasing
volume claims, but there was a case that we missed. During a node
drain with a controller attach/detach, we can hit a race where we call
controller publish before the unpublish has completed. This is
discouraged in the spec but plugins are supposed to handle it
safely. But if the storage provider's API is slow enough and the
plugin doesn't handle the case safely, the volume can get "locked"
into a state where the provider's API won't detach it cleanly.

Check the claim before making any external controller publish RPC
calls so that Nomad is responsible for the canonical information about
whether a volume is currently claimed.

This has a couple side-effects that also had to get fixed here:

  • Changing the order means that the volume will have a past claim
    without a valid external node ID because it came from the client, and
    this uncovered a separate bug where we didn't assert the external node
    ID was valid before returning it. Fallthrough to getting the ID from
    the plugins in the state store in this case. We avoided this
    originally because of concerns around plugins getting lost during node
    drain but now that we've fixed that we may want to revisit it in
    future work.
  • We should make sure we're handling FailedPrecondition cases from
    the controller plugin the same way we handle other retryable cases.
  • Several tests had to be updated because they were assuming we fail
    in a particular order that we're no longer doing.

No changelog entry because this is updating code that hasn't yet shipped.

Fixed E2E test from #12384

$ go test -v . -suite CSI -run 'TestE2E/CSI/\*csi\.CSIControllerPluginEBSTest/TestNodeDrain'
=== RUN   TestE2E
=== RUN   TestE2E/CSI
=== RUN   TestE2E/CSI/*csi.CSIControllerPluginEBSTest
=== RUN   TestE2E/CSI/*csi.CSIControllerPluginEBSTest/TestNodeDrain
--- PASS: TestE2E (114.61s)
    --- PASS: TestE2E/CSI (114.61s)
        --- PASS: TestE2E/CSI/*csi.CSIControllerPluginEBSTest (114.60s)
            --- PASS: TestE2E/CSI/*csi.CSIControllerPluginEBSTest/TestNodeDrain (42.92s)
PASS
ok      github.com/hashicorp/nomad/e2e  115.513s

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/b-csi-volume-detach-order/evenly-cosmic-eft branch from 0c5211f to 8a24bc5 Compare April 20, 2022 00:05
@hc-github-team-nomad-core hc-github-team-nomad-core merged commit ce4e4ec into release/1.2.x Apr 20, 2022
@hc-github-team-nomad-core hc-github-team-nomad-core deleted the backport/b-csi-volume-detach-order/evenly-cosmic-eft branch April 20, 2022 00:05
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants