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

Flex volumes which implement getvolumename API are getting unmounted during run time. #44737

Closed
chakri-nelluri opened this issue Apr 20, 2017 · 13 comments
Labels
milestone/removed sig/storage Categorizes an issue or PR as relevant to SIG Storage.

Comments

@chakri-nelluri
Copy link
Contributor

chakri-nelluri commented Apr 20, 2017

Kubernetes version: 1.6
Component/Area: Storage
Affected modules: Flex volume

Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.0-alpha.1.482+b2ea780731417d-dirty", GitCommit:"b2ea780731417da74d312bfce8ac560ae7248831", GitTreeState:"dirty", BuildDate:"2017-02-07T21:51:55Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"6+", GitVersion:"v1.6.1-1+00a638423087f6-dirty", GitCommit:"00a638423087f6e81819667f662f194a2a2d8da9", GitTreeState:"dirty", BuildDate:"2017-04-15T16:16:36Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}

What happened:
Flex volumes which implement getvolumename API are getting unmounted during run time.

What you expected to happen:
Volumes should not be unmounted.

How to reproduce it (as minimally and precisely as possible):
Use flex volume driver which implements getvolumename.

Anything else we need to know:
Workaround:

  • Do not implement getvolumename API. The API default uses PV Name as the volume name.
  • Detach call uses volume name, so the plugin detach has to work with PV Name.

Temporary fix for 1.6:

  • Pass PV Name to flex volume driver using extra options.
@chakri-nelluri
Copy link
Contributor Author

Investigation:

  • Reconciler is trying to reconstruct volume spec. Today we do not store any metadata, so flex volume options are missing/cannot be reconstructed in volume spec.
  • Getvolumename returns wrong volume name using this reconstructed volume spec.
  • Reconciler unmounts the existing volume(which has different name) as it does not match desired state.

@saad-ali saad-ali added this to the v1.7 milestone Apr 21, 2017
@saad-ali
Copy link
Member

@chakri-nelluri and I discussed this. Proposed fix is to add a metadata file so that volume reconstruction can use that and recover complete volume spec instead of just the information in the mount path.

CC @jingxu97 @kubernetes/sig-storage-bugs

@saad-ali saad-ali added the sig/storage Categorizes an issue or PR as relevant to SIG Storage. label Apr 21, 2017
deleteriousEffect pushed a commit to LINBIT/drbd-flexvolume that referenced this issue May 22, 2017
k8s-github-robot pushed a commit that referenced this issue May 30, 2017
Automatic merge from submit-queue

Remove broken getvolumename and pass PV or volume name to attach call

What this PR does / why we need it:
Flex getvolumename is broken in 1.6. It needs to be fixed comprehensively in 1.7 release. Removing the api in 1.6. Also pass PV or volume name to the driver during attach call. Detach uses PV or volume name, so plugin can use that information to map to PV.
Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #
Fixes - #44737

Original PR: #46136
Moving to this PR and rebase to release-1.6
@saad-ali
Copy link
Member

saad-ali commented Jun 7, 2017

@chakri-nelluri, @shilpamayanna:

Freeze date for 1.7 was June 1, so we missed the boat for the big fix (kubernetes/community#650).

In the meantime is there anything temporary that needs to go in for 1.7 to mitigate this in the master/1.7 branches?

@saad-ali
Copy link
Member

saad-ali commented Jun 9, 2017

CC @verult who's looking in to Flex volume issues.

k8s-github-robot pushed a commit that referenced this issue Jun 15, 2017
Automatic merge from submit-queue (batch tested with PRs 47204, 46808, 47432, 47400, 47099)

Remove broken getvolumename and pass PV or volume name to attach call

Cherry-picking #46249 to master

What this PR does / why we need it:
Flex getvolumename is broken in 1.6. It needs to be fixed comprehensively in 1.7 release. Removing the api in 1.6. Also pass PV or volume name to the driver during attach call. Detach uses PV or volume name, so plugin can use that information to map to PV.
Which issue this PR fixes (optional, in fixes #(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #
Fixes - #44737
@saad-ali
Copy link
Member

With #47400 this is complete for 1.7. Moving to 1.8 for "real fix"

@saad-ali saad-ali modified the milestones: v1.8, v1.7 Jun 16, 2017
@klausenbusk
Copy link
Contributor

The current behavior (1.7.0) seems a bit broken/weird.
With a volumes spec like so:

volumes:
- name: "datadir"
  flexVolume:
    driver: "sp/dobs"
    fsType: "ext4"
    options:
      volumeName: mysql-development

K8s would call:

(kube-controller-manager) attach {"kubernetes.io/fsType":"ext4","kubernetes.io/pvOrVolumeName":"datadir","kubernetes.io/readwrite":"rw","volumeName":"mysql-development"} 165.227.x.x
(kubelet) waitforattach /dev/disk/by-id/scsi-0DO_Volume_mysql-development {"kubernetes.io/fsType":"","kubernetes.io/pvOrVolumeName":"datadir","kubernetes.io/readwrite":"rw","volumeName":"mysql-development"}

But when detaching it call:

detach datadir 165.227.x.x

but the doc says:

<driver executable> detach <mount device> <node name>
<driver executable> waitforattach <mount device> <json options>

So I would expect it to call:

detach /dev/disk/by-id/scsi-0DO_Volume_mysql-development 165.227.x.x

So either the doc is wrong or something is broken.

The current behavior means that I can't use a meaningful volumeName in the podSpec, as the volumeName need to match my custom option volumeName which is passed to my flexVolume plugin.

So:

volumes:
- name: "mysql-development"
  flexVolume:
    driver: "sp/dobs"
    fsType: "ext4"
    options:
      volumeName: mysql-development

@klausenbusk
Copy link
Contributor

This broken behavior is caused by: #47400 :/

@klausenbusk
Copy link
Contributor

Issue opened: #51407

We need a proper fix for this, the current behavior isn't ideal.

@chakri-nelluri
Copy link
Contributor Author

Thanks @klausenbusk This is a doc issue. I will update it.

If you have any other use case, please feel free to slack me @chakri-nelluri or reply here. I want to know more details.

@k8s-github-robot
Copy link

[MILESTONENOTIFIER] Milestone Removed

@chakri-nelluri

Important:
This issue was missing labels required for the v1.8 milestone for more than 7 days:

kind: Must specify exactly one of [kind/bug, kind/cleanup, kind/feature].
priority: Must specify exactly one of [priority/critical-urgent, priority/important-longterm, priority/important-soon].

Removing it from the milestone.

Additional instructions available here The commands available for adding these labels are documented here

@k8s-github-robot k8s-github-robot removed this from the v1.8 milestone Sep 9, 2017
@mingfang
Copy link

detach() should be called with at least the same parameters as the attach() call.

@klausenbusk
Copy link
Contributor

klausenbusk commented Nov 16, 2017

Is their any plan on improving this? I don't like the current solution, as every volume name need to be unique. A consequence thereof, is that people can't use PV with the same name in different namespaces. (Edit: Not sure about that)

A hack around it, is naming the PV like name-<UUID>, but that is hackish.. :/

Edit: I totally misunderstood this, sorry for the noise :/

@chakri-nelluri
Copy link
Contributor Author

This is already fixed as part of 47400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
milestone/removed sig/storage Categorizes an issue or PR as relevant to SIG Storage.
Projects
None yet
Development

No branches or pull requests

6 participants