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

[release-1.3] Fix windows NodePublish failing because mount target doesn't exist #1083

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion charts/aws-ebs-csi-driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Helm chart

## v2.1.2
## v2.3.1

* Bump app/driver version to `v1.3.1`

## v2.3.0

* Support overriding controller `--default-fstype` flag via values

## v2.2.1

* Bump app/driver version to `v1.3.0`

## v2.2.0

* Support setting imagePullPolicy for all containers

## v2.1.1

* Bump app/driver version to `v1.2.1`
Expand Down
4 changes: 2 additions & 2 deletions charts/aws-ebs-csi-driver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
appVersion: 1.3.0
appVersion: 1.3.1
name: aws-ebs-csi-driver
description: A Helm chart for AWS EBS CSI Driver
version: 2.1.2
version: 2.3.1
kubeVersion: ">=1.17.0-0"
home: https://github.com/kubernetes-sigs/aws-ebs-csi-driver
sources:
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/overlays/stable/ecr/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bases:
images:
- name: k8s.gcr.io/provider-aws/aws-ebs-csi-driver
newName: 602401143452.dkr.ecr.us-west-2.amazonaws.com/eks/aws-ebs-csi-driver
newTag: v1.3.0
newTag: v1.3.1
- name: k8s.gcr.io/sig-storage/csi-provisioner
newName: public.ecr.aws/eks-distro/kubernetes-csi/external-provisioner
newTag: v2.1.1-eks-1-18-3
Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/overlays/stable/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ bases:
- ../../base
images:
- name: k8s.gcr.io/provider-aws/aws-ebs-csi-driver
newTag: v1.3.0
newTag: v1.3.1
- name: k8s.gcr.io/sig-storage/csi-provisioner
newTag: v2.1.1
- name: k8s.gcr.io/sig-storage/csi-attacher
Expand Down
4 changes: 1 addition & 3 deletions examples/kubernetes/windows/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
## Windows

**This example requires unreleased versions of csi-proxy and the driver that. It is intended for developers only for now. It will be updated once the driver has been released. Only basic read/write (mount/unmount and attach/detach) functionality has been tested, other features like resize don't work yet.**

This example shows how to create a EBS volume and consume it from a Windows container dynamically.


## Prerequisites

1. A 1.18+ Windows node. Windows support has only been tested on 1.18 EKS Windows nodes. https://docs.aws.amazon.com/eks/latest/userguide/windows-support.html
2. [csi-proxy](https://github.com/kubernetes-csi/csi-proxy) v1.0.0+ installed on the Windows node.
3. An image of the driver built for Windows. It can be built and pushed with the command `TAG=$MY_TAG REGISTRY=$MY_REGISTRY make all-push` where `MY_TAG` refers to the image tag to push and `MY_REGISTRY` to the destination image registry like "XXXXXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com"
3. Driver v1.3.2 from GCR k8s.gcr.io/provider-aws/aws-ebs-csi-driver:v1.3.2. It can be built and pushed to another image registry with the command `TAG=$MY_TAG REGISTRY=$MY_REGISTRY make all-push` where `MY_TAG` refers to the image tag to push and `MY_REGISTRY` to the destination image registry like "XXXXXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com"
Copy link

@nckturner nckturner Oct 11, 2021

Choose a reason for hiding this comment

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

Suggested change
3. Driver v1.3.2 from GCR k8s.gcr.io/provider-aws/aws-ebs-csi-driver:v1.3.2. It can be built and pushed to another image registry with the command `TAG=$MY_TAG REGISTRY=$MY_REGISTRY make all-push` where `MY_TAG` refers to the image tag to push and `MY_REGISTRY` to the destination image registry like "XXXXXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com"
3. Driver v1.3.2 from GCR: `k8s.gcr.io/provider-aws/aws-ebs-csi-driver:v1.3.2`.
It can be built and pushed to another image registry with the command `TAG=$MY_TAG REGISTRY=$MY_REGISTRY make all-push` where `MY_TAG` refers to the image tag to push and `MY_REGISTRY` to the destination image registry like "XXXXXXXXXXXX.dkr.ecr.us-west-2.amazonaws.com"

4. The driver installed with the Node plugin on the Windows node and the Controller plugin on a Linux node: `helm upgrade --install aws-ebs-csi-driver --namespace kube-system ./charts/aws-ebs-csi-driver --set node.enableWindows=true --set image.repository=$MY_REGISTRY/aws-ebs-csi-driver --set image.tag=$MY_TAG`

## Usage
Expand Down
13 changes: 9 additions & 4 deletions pkg/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ func (d *nodeService) nodePublishVolumeForBlock(req *csi.NodePublishVolumeReques
//Checking if the target file is already mounted with a device.
mounted, err := d.isMounted(source, target)
if err != nil {
return status.Errorf(codes.Internal, "Could not mount %q at %q: %v", source, target, err)
return status.Errorf(codes.Internal, "Could not check if %q is mounted: %v", target, err)
}

if !mounted {
Expand Down Expand Up @@ -626,15 +626,20 @@ func (d *nodeService) isMounted(source string, target string) (bool, error) {
//After successful unmount, the device is ready to be mounted.
return !notMnt, nil
}
return !notMnt, status.Errorf(codes.Internal, "Could not mount %q at %q: %v", source, target, err)
return !notMnt, status.Errorf(codes.Internal, "Could not check if %q is a mount point: %v, %v", target, err, pathErr)
}

if !notMnt {
klog.V(4).Infof("NodePublishVolume: Target path %q is already mounted", target)
return !notMnt, nil
}

return !notMnt, err
// Do not return os.IsNotExist error. Other errors were handled above. It is

Choose a reason for hiding this comment

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

Why isn't an error desirable here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the idea is to ignore these because the caller should check that independently of whether target exists or ought to exist or not. since this is a cherry pick from master branch to release-1.3 I will submit a follow up fix to master branch to clean this up a bit. Like since now the function returns !notMnt, nil regardless of value of notMnt the above if statement can be simplified

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 edited PR description to say this is acherry-pick of #1081.

https://github.com/kubernetes-sigs/aws-ebs-csi-driver/pull/1087/files is PR to master trying to make it more understandable .

// the responsibility of the caller to check whether the given target path
// exists (in Linux, the target mount directory must exist before mount is
// called on it) or not (in Windows, the target must NOT exist before a
// symlink is created at it)
return !notMnt, nil
}

func (d *nodeService) nodePublishVolumeForFileSystem(req *csi.NodePublishVolumeRequest, mountOptions []string, mode *csi.VolumeCapability_Mount) error {
Expand Down Expand Up @@ -665,7 +670,7 @@ func (d *nodeService) nodePublishVolumeForFileSystem(req *csi.NodePublishVolumeR
mounted, err := d.isMounted(source, target)

if err != nil {
return status.Errorf(codes.Internal, "Could not mount %q at %q: %v", source, target, err)
return status.Errorf(codes.Internal, "Could not check if %q is mounted: %v", target, err)
}

if !mounted {
Expand Down