-
Notifications
You must be signed in to change notification settings - Fork 187
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
Fixes ReconcileVA for non-migratable drivers #244
Conversation
Welcome @yuga711! |
Hi @yuga711. 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. Instructions 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 |
Can you please check the unit tests? They test with "com.test.foo" driver. Why did they succeed? Should they be fixed? Or can you please add a new unit test that covers your code change? |
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.
Can you please check the unit tests? They test with "com.test.foo" driver. Why did they succeed? Should they be fixed? Or can you please add a new unit test that covers your code change?
I was curious about this too. We seem to already have unit tests for ReconcileVA. I think it's because the fake for RepairVolumeHandle always succeeds. I wonder though, why do we need a fake translator? Can we use the real one?
Can you update the PR title and description to be more specific to the issue, something like "Fixes ReconcileVA for non-migratable drivers" |
Switched to real translator. Added new checks. Fixed several broken existing tests. |
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.
I haven't taken a deep look at the test changes yet, will do that tomorrow
@@ -34,6 +34,7 @@ import ( | |||
"k8s.io/client-go/informers" | |||
"k8s.io/client-go/kubernetes" | |||
core "k8s.io/client-go/testing" | |||
csitranslator "k8s.io/csi-translation-lib" |
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.
Can we add a test case for ReconcileVA using a volume type that does support migration?
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.
These are the ones that truly support in the actual translator. Do you suggest unit tests based on this? (or) we could setup a fake translator that migration support. If it's not simple work, can we do this separately?
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.
I think adding a unit test using one of the supported translated types would be good.
Did you try running the fixed tests without your fix to ReconcileVA, to see if the test fails as expected? |
Yes, the tests fail as expected when I ran them without fix. ie the tests complain saying the expected number of csi calls were not run... |
pkg/controller/csi_handler_test.go
Outdated
va(false /*attached*/, fin, nil))), | ||
core.NewPatchSubresourceAction(vaGroupResourceVersion, metav1.NamespaceNone, testPVName+"-"+testNodeName, | ||
types.MergePatchType, patch(va(false /*attached*/, "", nil), | ||
va(false, "", nil)), "status"), |
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.
This change is odd:
-
The patch is empty. My tests show that the attacher indeed executes empty PATCH
{}
. Is there a bug in the attacher? -
While the resulting patch is empty, the way it's constructed is wrong - it expects that the volume gets detached (
va(false, ...
) - should it betrue
? The volume was attached successfully.
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.
Haven't found if there is a bug executing empty patch.
Fixed the patch construction logic in the test.
pkg/controller/csi_handler_test.go
Outdated
/* TBD | ||
{ | ||
name: "GCE PD va attached actual state not attached", |
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.
In general, the patch looks good, is this the only thing missing?
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.
I wanted to add a test with one of the supported translator types. Now planning to do that separately. I have created a github issue and added a TODO here.
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.
In general, the patch looks good, is this the only thing missing?
I wanted to add a test with one of the supported translator types. Now planning to do that separately. I have created a github issue and added a TODO here.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, yuga711 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 |
b54c1ba4 Merge pull request kubernetes-csi#246 from xing-yang/go_1.21 5436c81e Change go version to 1.21.5 267b40e9 Merge pull request kubernetes-csi#244 from carlory/sig-storage b42e5a2d nominate self (carlory) as kubernetes-csi reviewer a17f536f Merge pull request kubernetes-csi#210 from sunnylovestiramisu/sidecar 011033de Use set -x instead of die 5deaf667 Add wrapper script for sidecar release git-subtree-dir: release-tools git-subtree-split: b54c1ba49469d4d5d1b5d75285e8868ffe3d328f
dc4d0ae2 Merge pull request kubernetes-csi#249 from jsafrane/use-go-version e681b170 Use .go-version to get Kubernetes go version b54c1ba4 Merge pull request kubernetes-csi#246 from xing-yang/go_1.21 5436c81e Change go version to 1.21.5 267b40e9 Merge pull request kubernetes-csi#244 from carlory/sig-storage b42e5a2d nominate self (carlory) as kubernetes-csi reviewer a17f536f Merge pull request kubernetes-csi#210 from sunnylovestiramisu/sidecar 011033de Use set -x instead of die 5deaf667 Add wrapper script for sidecar release f8c8cc4c Merge pull request kubernetes-csi#237 from msau42/prow b36b5bfd Merge pull request kubernetes-csi#240 from dannawang0221/upgrade-go-version adfddcc9 Merge pull request kubernetes-csi#243 from pohly/git-subtree-pull-fix c4650889 pull-test.sh: avoid "git subtree pull" error 7b175a1e Update csi-test version to v5.2.0 987c90cc Update go version to 1.21 to match k/k 2c625d41 Add script to generate patch release notes f9d5b9c0 Merge pull request kubernetes-csi#236 from mowangdk/feature/bump_csi-driver-host-path_version b01fd537 Bump csi-driver-host-path version up to v1.12.0 984feece Merge pull request kubernetes-csi#234 from siddhikhapare/csi-tools 1f7e6059 fixed broken links of testgrid dashboard git-subtree-dir: release-tools git-subtree-split: dc4d0ae20a3dcce17fbfc745fb1f1e3b10cd9644
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR fixes an issue in the volume attachment reconciler. Currently, the reconciler calls a method (unconditionally) that is supposed to be called only when the corresponding volume driver implements the in-tree plugin.
The PR also fixes a few existing broken tests.
Which issue(s) this PR fixes:
Fixes #243
Special notes for your reviewer:
Tested the fix with csi-mock driver. The driver does not implement in-tree plugin.
Without the fix, the reconciler failed as below:
With the fix, no such failure was observed.
Does this PR introduce a user-facing change?: