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

Add volume spec to mountedPod in actual state of world #61549

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

jingxu97
Copy link
Contributor

@jingxu97 jingxu97 commented Mar 22, 2018

Add volume spec into mountedPod data struct in the actual state of the
world.
Fixes issue #61248

Release note:

Add volume spec to mountedPod in actual state of world to fix the collision issue when two or more pods are allowed to use the same volume

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 22, 2018
@k8s-ci-robot
Copy link
Contributor

@jingxu97: Adding do-not-merge/release-note-label-needed because the release note process has not been followed.

One of the following labels is required "release-note", "release-note-action-required", or "release-note-none".
Please see: https://git.k8s.io/community/contributors/devel/pull-requests.md#write-release-notes-if-needed.

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.

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 22, 2018
@k8s-ci-robot k8s-ci-robot requested review from saad-ali and verult March 22, 2018 16:50
// In particular, the Unmount method uses spec.Name() as the volumeSpecName
// in the mount path:
// /var/lib/kubelet/pods/{podUID}/volumes/{escapeQualifiedPluginName}/{volumeSpecName}/
spec *volume.Spec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we name this volumeSpec? Not to be confused with pod spec

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. To improve readability we should name this volumeSpec. Currently the code reads - mountedPod.Spec which almost sounds like it is pod spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed the name from desired state data structure. If preferred, I can change in both places?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to have just this one renamed to volumeSpec but your call.

@jingxu97 jingxu97 changed the title WIP: add volume spec to mountedPod in actual state of world Add volume spec to mountedPod in actual state of world Mar 28, 2018
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 28, 2018
@jingxu97 jingxu97 force-pushed the Mar/aswVolumeSpec branch from 62a2ae3 to 5da43cc Compare March 28, 2018 18:58
@jingxu97 jingxu97 requested a review from gnufied March 28, 2018 19:59
Copy link
Member

@gnufied gnufied left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good. But one potential problem is - we have Spec stored in both mountedPod and attachedVolume field and it is not clear which one should be used when. Obviously if you read the code carefully, one can see that mountedPod.Spec is not available after volume is unmounted (but device is still mounted).

We should file a follow up github issue to clean it up.

@@ -713,7 +724,7 @@ func getMountedVolume(
MountedVolume: operationexecutor.MountedVolume{
PodName: mountedPod.podName,
VolumeName: attachedVolume.volumeName,
InnerVolumeSpecName: attachedVolume.spec.Name(),
InnerVolumeSpecName: mountedPod.spec.Name(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct contains volume.Spec too derived from attachedVolume field. So potentially we are carrying around invalid spec all the time?

Can we replace Spec in MountedVolume to mountedPod.Spec ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think we should use mountedPod.Spec

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning to replace this or as part of follow up PR?

@jingxu97
Copy link
Contributor Author

/retest

@jingxu97
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce

@jingxu97
Copy link
Contributor Author

@gnufied @saad-ali I also manually tested this PR. To reproduce the issue, I add a delay during volume unmount so the first volume will be still in actual state when the second volume is added to cause the volume spec conflict. Without this fix, the test will always fail. While with this PR, the test can pass.

@gnufied
Copy link
Member

gnufied commented Mar 29, 2018

@jingxu97 the commit still has "WIP:xxx" in it btw - can you reword it?

@jingxu97 jingxu97 force-pushed the Mar/aswVolumeSpec branch from 5da43cc to 8fd9bfd Compare March 29, 2018 19:09
@jingxu97
Copy link
Contributor Author

@gnufied I removed the WIP. PTAL. Thanks!

OuterVolumeSpecName: mountedPod.outerVolumeSpecName,
PluginName: attachedVolume.pluginName,
PodUID: mountedPod.podUID,
Mounter: mountedPod.mounter,
BlockVolumeMapper: mountedPod.blockVolumeMapper,
VolumeGidValue: mountedPod.volumeGidValue,
VolumeSpec: attachedVolume.spec,
VolumeSpec: mountedPod.volumeSpec,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we cover this with some simple unit tests? Such that - when someone adds 2 pods with same PD-name then returned mounted volumes should have correct values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added unit test for this. PTAL. Thanks!

@jingxu97 jingxu97 force-pushed the Mar/aswVolumeSpec branch from 8fd9bfd to 03d1d55 Compare March 29, 2018 21:35
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 29, 2018
@gnufied
Copy link
Member

gnufied commented Mar 29, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 29, 2018
@jingxu97 jingxu97 force-pushed the Mar/aswVolumeSpec branch from 03d1d55 to 6089c45 Compare March 29, 2018 22:56
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 29, 2018
@jingxu97 jingxu97 force-pushed the Mar/aswVolumeSpec branch from 6089c45 to bdf7040 Compare March 29, 2018 23:09
@saad-ali saad-ali added this to the v1.10 milestone Apr 6, 2018
@saad-ali saad-ali removed the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Apr 6, 2018
@jingxu97
Copy link
Contributor Author

jingxu97 commented Apr 6, 2018

@Random-Liu Could you please help approve this PR? Thanks!

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Removed From Pull Request

@gnufied @jingxu97

Important: This pull request was missing labels required for the v1.10 milestone for more than 3 days:

kind: Must specify exactly one of kind/bug, kind/cleanup or kind/feature.
priority: Must specify exactly one of priority/critical-urgent, priority/important-longterm or priority/important-soon.
sig owner: Must specify at least one label prefixed with sig/.

Help

@saad-ali
Copy link
Member

/test pull-kubernetes-e2e-gce

@Random-Liu
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnufied, jingxu97, Random-Liu, saad-ali

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2018
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit 05c88cc into kubernetes:master Apr 11, 2018
@gnufied
Copy link
Member

gnufied commented Apr 11, 2018

@saad-ali @jingxu97 Filed a follow up issue for removing volume.Spec from attachedVolume - #62392

@fabiand
Copy link
Contributor

fabiand commented Apr 13, 2018

will this fix be pciked over into release-1.10?

@fabiand
Copy link
Contributor

fabiand commented Apr 13, 2018

It seems that block mode is unusable due to this, because devicePath will never appear in the container

stu-gott added a commit to stu-gott/kubevirt that referenced this pull request Apr 13, 2018
Other minor fixes included.
This is predicated on: kubernetes/kubernetes#61549
@saad-ali
Copy link
Member

Thanks @gnufied!! And yes, this needs to be cherry picked back to 1.10

@jingxu97
Copy link
Contributor Author

@fabiand could you please describe in more details about what you mean "It seems that block mode is unusable due to this, because devicePath will never appear in the container" Thanks!

@fabiand
Copy link
Contributor

fabiand commented Apr 23, 2018

@jingxu97 I might have been to quick it could actually be that we tested a version which did not have iSCSI support (openshift 3.9) - so let me check that before providing more evidence for my claim above.

stu-gott added a commit to stu-gott/kubevirt that referenced this pull request May 16, 2018
Other minor fixes included.
This is predicated on: kubernetes/kubernetes#61549
@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 9, 2018
k8s-ci-robot referenced this pull request Oct 11, 2018
…49-upstream-release-1.10

Add volume spec to mountedPod in actual state of world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. milestone/removed release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants