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

Fix mount collision timeout issue #29673

Merged
merged 2 commits into from
Jul 28, 2016

Conversation

pmorie
Copy link
Member

@pmorie pmorie commented Jul 27, 2016

Short- or medium-term workaround for #29555. The root issue being fixed here is that the recent attach/detach work in the kubelet uses a unique volume name as a key that tracks the work that has to be done for each volume in a pod to attach/mount/umount/detach. However, the non-attachable volume plugins do not report unique names for themselves, which causes collisions when a single secret or configmap is mounted multiple times in a pod.

This is still a WIP -- I need to add a couple E2E tests that ensure that tests break in the future if there is a regression -- but posting for early review.

cc @kubernetes/sig-storage

Ultimately, I would like to refine this a bit further. A couple things I would like to change:

  1. GetUniqueVolumeName should be a property ONLY of attachable volumes
  2. I would like to see the kubelet apparatus for attach/mount/umount/detach handle non-attachable volumes specifically to avoid things like the WaitForControllerAttach call that has to be done for those volume types now

@pmorie pmorie added sig/storage Categorizes an issue or PR as relevant to SIG Storage. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 27, 2016
@pmorie pmorie added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jul 27, 2016
@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 27, 2016
@matchstick matchstick self-assigned this Jul 27, 2016
@k8s-cherrypick-bot
Copy link

Removing label cherrypick-candidate because no release milestone was set. This is an invalid state and thus this PR is not being considered for cherry-pick to any release branch. Please add an appropriate release milestone and then re-add the label.

// GetUniqueVolumeNameForNonAttachableVolume returns the unique volume name
// for a non-attachable volume.
func GetUniqueVolumeNameForNonAttachableVolume(volumePlugin volume.VolumePlugin, podNamespace, podName, podSpecName string) api.UniqueVolumeName {
return api.UniqueVolumeName(fmt.Sprintf("%s/%s-%s-%s", volumePlugin.GetPluginName(), podNamespace, podName, podSpecName))
Copy link
Member Author

Choose a reason for hiding this comment

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

@jingxu97 I'm changing this to use the pod UID instead of the namespace and name to aid you in #27970

Copy link
Member

Choose a reason for hiding this comment

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

Yep that would great

Copy link
Contributor

Choose a reason for hiding this comment

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

@pmorie, thanks for addressing this. Now I am still thinking whether this
change may affect our initial intention of avoiding operating mount/mount
for the same volume/pod. If for the same pod/volume, it is ok mount
parallel if the inner/outterspec name is different, then it should be fine.

On Wed, Jul 27, 2016 at 10:10 AM, Paul Morie notifications@github.com
wrote:

In pkg/volume/util/volumehelper/volumehelper.go
#29673 (comment)
:

@@ -52,6 +52,12 @@ func GetUniqueVolumeName(pluginName, volumeName string) api.UniqueVolumeName {
return api.UniqueVolumeName(fmt.Sprintf("%s/%s", pluginName, volumeName))
}

+// GetUniqueVolumeNameForNonAttachableVolume returns the unique volume name
+// for a non-attachable volume.
+func GetUniqueVolumeNameForNonAttachableVolume(volumePlugin volume.VolumePlugin, podNamespace, podName, podSpecName string) api.UniqueVolumeName {

  • return api.UniqueVolumeName(fmt.Sprintf("%s/%s-%s-%s", volumePlugin.GetPluginName(), podNamespace, podName, podSpecName))

@jingxu97 https://github.com/jingxu97 I'm changing this to use the pod
UID instead of the namespace and name to aid you in #27970
#27970


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/29673/files/e967f0d59934d271a8eca16f6582865614008d8f#r72480743,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ASSNxfEUFfXSNMgrEIUUJwFFRtyLn6B0ks5qZ5EagaJpZM4JWQGg
.

  • Jing

@@ -92,6 +92,7 @@ func (grm *nestedPendingOperations) Run(
grm.lock.Lock()
defer grm.lock.Unlock()

// search for an existing operation
Copy link
Contributor

Choose a reason for hiding this comment

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

@pmorie @saad-ali This is nice to have, but should we really bundle this in this PR? Is it unrelated? Same for the following comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take it out.

//
// TODO: in the future, we should be able to remove the volumeName
// argument to this method -- since it is used only for attachable
// volumes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@saad-ali @pmorie Can we open the github issue and include the number in this comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also add "why we do this" namely - "to ensure that the volume name used is unique."

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'll open an issue for follow-up.

@pmorie pmorie changed the title WIP: fix mount collision timeout issue Fix mount collision timeout issue Jul 27, 2016
For non-attachable volumes, do not call GetVolumeName on the plugin and instead
generate a unique name based on the identity of the pod and the name of the volume
within the pod.
@pmorie
Copy link
Member Author

pmorie commented Jul 27, 2016

@matchstick @saad-ali should be in a good state now, PTAL.

@k8s-bot
Copy link

k8s-bot commented Jul 27, 2016

GCE e2e build/test passed for commit f15684e.

@saad-ali saad-ali added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 28, 2016
@saad-ali
Copy link
Member

LGTM Thanks @pmorie

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 28, 2016

GCE e2e build/test passed for commit f15684e.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 1ae9b73 into kubernetes:master Jul 28, 2016
@fabioy fabioy added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Jul 28, 2016
@fabioy
Copy link
Contributor

fabioy commented Jul 28, 2016

@pmorie, @saad-ali Cherrypick approved. Please create a cherrypick PR.

fabioy added a commit that referenced this pull request Jul 28, 2016
…-upstream-release-1.3

Automated cherry pick of #29673
shyamjvs pushed a commit to shyamjvs/kubernetes that referenced this pull request Dec 1, 2016
…-of-#29673-upstream-release-1.3

Automated cherry pick of kubernetes#29673
shouhong pushed a commit to shouhong/kubernetes that referenced this pull request Feb 14, 2017
…-of-#29673-upstream-release-1.3

Automated cherry pick of kubernetes#29673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/storage Categorizes an issue or PR as relevant to SIG Storage. 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.

None yet

9 participants