Update VolumeAttachment.Finalizers as separate subresource in markAsDetatched#227
Conversation
|
Welcome @mattcary! |
|
Hi @mattcary. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/ok-to-test |
|
Test cases under https://github.com/kubernetes-csi/external-attacher/blob/master/pkg/controller/csi_handler_test.go need to be updated with the additional patch action for removing the finalizer. I think we can also look into this as a separate followup, but I don't see the https://github.com/kubernetes-csi/external-attacher/blob/master/pkg/controller/framework_test.go checking for volumattachment object deletion. A unit test checking for deletion probably could have caught this issue. cc @jsafrane |
|
Tests are fixed. For correctly checking that the volumes are detached, would it be enough to just check through the vaInformer that there are no such resources (modulo adding a flag or something for test cases that we expect to leave VAs hanging about)? |
|
I'm not sure the fake client/informer is going to handle deletion of the object after we remove all the finalizers. Maybe something we can at least check for in some test case, is that the finalizer is cleared from the object? |
| types.MergePatchType, patch(deleted(va(false, "", ann)), | ||
| deleted(vaWithDetachError(va(false, "", ann), "persistentvolume \"pv1\" not found"))), | ||
| "status"), | ||
| core.NewPatchSubresourceAction(vaGroupResourceVersion, metav1.NamespaceNone, testPVName+"-"+testNodeName, |
There was a problem hiding this comment.
This is odd. This test case is supposed to fail the call the first two times, and then succeed on the 3rd.
There was a problem hiding this comment.
Weird indeed. The test passes with >= 1 actions and only fails when the first action is removed. I'm trying to puzzle out what's going on.
There was a problem hiding this comment.
Ok, I figured out what was going on with the test. Turns out it wasn't actually testing what it said it was (wrong verb in the reactor), and even then the expected actions weren't behaving as they probably were expected to. I've clarified it all in a comment (or tried to).
There was a problem hiding this comment.
Ok, the test case itself is kind of strange, but I can see the benefit for adding an additional call to verify that we do retry.
My one last nit is that there's actually 5 loops but the comment says 4.
So the actions/fake clientset don't actually change any of the resource AFAIU. In order to check that the finalizer is cleared, we'd have to manually apply the patch. However, the Patch Action doesn't seem to expose any subresources, so we couldn't accurately test the main thing we want to test. At least that I can tell. sigh. The idea is close; framework_test.go does exactly that for Updates. I'm open to further ideas if you have them. |
|
Yeah I don't have any great ideas. Opened #228 to track investigating possible solutions. One more last thing, can you squash your commits to 1? |
This also fixes a pre-existing bug in "detach unknown PV -> error + error saving the error" which had an incorrect reactor verb and wasn't testing what it thought it was.
|
Squashed. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattcary, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1df23dba Merge pull request kubernetes-csi#230 from msau42/prow 1f92b7e7 Add ginkgo timeout to e2e tests to help catch any stuck tests c10b6780 Merge pull request kubernetes-csi#227 from coulof/check-sidecar-supported-versions b0555351 Header bd0a10b6 typo c39d73c3 Add comments f6491af0 Script to verify EOL sidecar version git-subtree-dir: release-tools git-subtree-split: 1df23dba61da5d4e52ae79e6e1571f9d1d94311d
1df23dba Merge pull request kubernetes-csi#230 from msau42/prow 1f92b7e7 Add ginkgo timeout to e2e tests to help catch any stuck tests c10b6780 Merge pull request kubernetes-csi#227 from coulof/check-sidecar-supported-versions b0555351 Header bd0a10b6 typo c39d73c3 Add comments f6491af0 Script to verify EOL sidecar version git-subtree-dir: release-tools git-subtree-split: 1df23dba61da5d4e52ae79e6e1571f9d1d94311d
/kind bug
What this PR does / why we need it:
The update of the VolumeAttachment version from v1beta to v1 changed its status to be a subresource. markAsDetached() updated both the status and the finalizers in a single patch, and the update to v1 blindly put in a "status" subresource restriction, causing the finalizer removal to be silently ignored. This change removes the finalizer in a second patch.
Which issue(s) this PR fixes:
Fixes #225
(release note edited by jsafrane, this bug has not been in any released external-attacher)