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 support for 'path' field in volumeContext #52

Merged
merged 2 commits into from
Jul 25, 2019

Conversation

wongma7
Copy link
Contributor

@wongma7 wongma7 commented Jul 18, 2019

Is this a bug fix or adding new feature? feature

What is this PR about? / Why do we need it? fixes #46.

the path must exist on the filesystem beforehand else mounting will fail.

depends on #48

no docs updates yet--I plan to do document all doc changes in one PR if that's okay.

What testing is done?
on kube master:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: efs-pv
spec:
  capacity:
    storage: 5Gi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName: efs-sc
  csi:
    driver: efs.csi.aws.com
    volumeHandle: fs-c2a43e69
    volumeAttributes:
      path: "/a/b"
I0718 20:50:34.587437       1 node.go:49] NodePublishVolume: called with args volume_id:"fs-c2a43e69" target_path:"/var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount" volume_capability:<mount:<> access_mode:<mode:SINGLE_NODE_WRITER > > volume_context:<key:"path" value:"/a/b" >
I0718 20:50:34.587497       1 node.go:103] NodePublishVolume: creating dir /var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount
I0718 20:50:34.587524       1 node.go:108] NodePublishVolume: mounting fs-c2a43e69:/a/b at /var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount with options []
I0718 20:50:34.587534       1 mount_linux.go:146] Mounting cmd (mount) with arguments ([-t efs fs-c2a43e69:/a/b /var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount])
...
I0718 20:53:28.621904       1 node.go:118] NodeUnpublishVolume: called with args volume_id:"fs-c2a43e69" target_path:"/var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount"
I0718 20:53:28.621963       1 node.go:125] NodeUnpublishVolume: unmounting /var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount
I0718 20:53:28.621969       1 mount_linux.go:211] Unmounting /var/lib/kubelet/pods/a7d6f292-afd5-469a-93da-b6e46f382e08/volumes/kubernetes.io~csi/efs-pv/mount

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 18, 2019
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 18, 2019
@leakingtapan
Copy link
Contributor

the path must exist on the filesystem beforehand else mounting will fail.

How will it fail when the path doesn't exist? Could you give more test output for this case?

@wongma7
Copy link
Contributor Author

wongma7 commented Jul 19, 2019

Like so:

  Warning  FailedMount  0s (x3 over 3s)  kubelet, 127.0.0.1  MountVolume.SetUp failed for volume "efs-pv" : rpc error: code = Internal desc = Could not mount "fs-c2a43e69:/asdf/qwer" at "/var/lib/kubelet/pods/6e1b1dd0-7f11-44ac-ad1c-5b54f1a04b9c/volumes/kubernetes.io~csi/efs-pv/mount": mount failed: exit status 32
Mounting command: mount
Mounting arguments: -t efs fs-c2a43e69:/asdf/qwer /var/lib/kubelet/pods/6e1b1dd0-7f11-44ac-ad1c-5b54f1a04b9c/volumes/kubernetes.io~csi/efs-pv/mount
Output: mount.nfs4: mounting fs-c2a43e69.efs.us-west-2.amazonaws.com:/asdf/qwer failed, reason given by server: No such file or directory

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 19, 2019
@leakingtapan
Copy link
Contributor

leakingtapan commented Jul 25, 2019

Thx for providing the details of error message.

I think requiring user to create the directory before mounting is a hard requirement that could affect user experience. Especially when there is not other Kubernetes native way to create the directory, user will have to mount the EFS fs somewhere and create the directory manually or build some automation by themselves for each path before they can use the volume.

Created a new issue to track this: #63

@leakingtapan
Copy link
Contributor

Can you also check if EFS supports mounting a file instead of directory?

@leakingtapan
Copy link
Contributor

The change looks good to me.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2019
@wongma7
Copy link
Contributor Author

wongma7 commented Jul 25, 2019

No file mounting allowed:
$ sudo mount fs-c2a43e69.efs.us-west-2.amazonaws.com:/out.txt -t efs a
mount.nfs4: mount spec fs-c2a43e69.efs.us-west-2.amazonaws.com:/out.txt or point /home/fedora/a is not a directory

@leakingtapan
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leakingtapan, wongma7

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 Jul 25, 2019
@k8s-ci-robot k8s-ci-robot merged commit f342f2e into kubernetes-sigs:master Jul 25, 2019
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. 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.

Create PV at subpath within filesystem
3 participants