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 GenerateUnmapVolumeFunc missing globalUnmapPath #123032
Conversation
…s to clean up all volumes that failed reconstruction.
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
/cc @jsafrane |
/assign @gnufied |
@@ -1295,7 +1295,12 @@ func (og *operationGenerator) GenerateUnmapVolumeFunc( | |||
// pods/{podUid}/volumeDevices/{escapeQualifiedPluginName}/{volumeName} | |||
podDeviceUnmapPath, volName := blockVolumeUnmapper.GetPodDeviceMapPath() | |||
// plugins/kubernetes.io/{PluginName}/volumeDevices/{volumePluginDependentPath}/{podUID} | |||
globalUnmapPath := volumeToUnmount.DeviceMountPath | |||
globalUnmapPath, err := blockVolumeUnmapper.GetGlobalMapPath(volumeToUnmount.VolumeSpec) |
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.
Is there an unit tests that could check globalUnmapPath is filed correctly?
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.
Only csi plugin and local volume plugin have unit test for GetGlobalMapPath
kubernetes/pkg/volume/csi/csi_block_test.go
Lines 54 to 55 in 46c9bd1
func TestBlockMapperGetGlobalMapPath(t *testing.T) { plug, tmpDir := newTestPlugin(t, nil) kubernetes/pkg/volume/local/local_test.go
Lines 426 to 427 in 46c9bd1
expectedGlobalPath := filepath.Join(tmpDir, testGlobalPath) globalPath, err := mapper.GetGlobalMapPath(volSpec)
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.
After I read the operation_generator_test.go, I cannot find an existing unit test for the GenerateUnmapVolumeFunc. And the other funcs are also lack of unit tests.
Isn't this very similar to #122211 ? Which fixes the issue by ensuring that we don't lose global unmap path during unmap failures? |
@gnufied Thanks for your fix. I believe this issue should be resolved by your PR. But this PR maybe still needed for a potential issue. i.e. if the volume is failed to be reconstructed, then the volume will be cleaned up. In this case, the global unmap path field is not filled in. You can see the code in the PR's description. |
I think this is still useful. #122211 fixes a bug when a Pod is still available (and will end up Terminating), while in this case the Pod may not be available at all. /lgtm |
LGTM label has been added. Git tree hash: 1cc5eac7c79b8ed06e054f3ca3c4a479cae0a4b1
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carlory, jsafrane 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 type of PR is this?
/kind bug
What this PR does / why we need it:
GenerateUnmapVolumeFunc missing globalUnmapPath when kubelet tries to clean up all volumes that failed reconstruction.
Which issue(s) this PR fixes:
Ref #122960
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: