-
Notifications
You must be signed in to change notification settings - Fork 159
Support GCEPD driver for Windows #483
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
Conversation
f8d2676
to
9b72ff0
Compare
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
/retest |
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
1 similar comment
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
1 similar comment
/test pull-gcp-compute-persistent-disk-csi-driver-e2e |
e7aa0f2
to
c8c2d8b
Compare
/test pull-gcp-compute-persistent-disk-csi-driver-kubernetes-integration |
/cc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass, need to review the rest of safe-mounter_windows.go
limitations under the License. | ||
*/ | ||
|
||
package gceGCEDriver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: definitely out of scope for this PR, but the convention is to avoid mixCaps: https://golang.org/doc/effective_go.html#package-names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack. we can do another PR for it.
pkg/gce-pd-csi-driver/utils_linux.go
Outdated
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common" | ||
) | ||
|
||
func GetDevicePath(ns *GCENodeServer, volumeID, partition string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all functions here have the same casing for the first letter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
pkg/mount-manager/statter_windows.go
Outdated
return false, nil | ||
} | ||
|
||
//TODO: implement StatFS to get metrics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: include username or issue #
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
return err | ||
} | ||
if exists { | ||
return proxy.Unmount(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Linux we reuse the path if it already exists. Why don't we unmount there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for windows, before mounting (which is creating symlink), the dir should not exist. Only the parent dir should be created. Now in kubelet, it creates this dir beforehand, so this is a workaround to remove the dir first.
Added some comments for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason when I reviewed, I didn't see Cheng's comments and asked the same thing :-)
What if the volume is actually mounted? In that case, I don't think we should do an entire Unmount if it's already done.
Another confusing piece here is that the behavior we want is really "rmdir", but we're calling an api called "unmount".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If volume is actually mounted, it should not call this function and return immediately
https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/pull/483/files#diff-37c748634a23b1ed91abeaa8a6d21525R108
in windows, actually unmount and rmdir is the same thing. Mount is to create a symlink, and unmount is to delete this link.
I rename the functions on this and related part. Please let me know if there is any issue.
}, nil | ||
} | ||
|
||
func (mounter *CSIProxyMounter) Mount(source string, target string, fstype string, options []string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this called anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in node.go line 172
go.mod
Outdated
gopkg.in/gcfg.v1 v1.2.3 | ||
gopkg.in/warnings.v0 v0.1.2 // indirect | ||
k8s.io/apimachinery v0.17.1 | ||
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible | ||
k8s.io/klog v1.0.0 | ||
k8s.io/kubernetes v1.14.7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this dependency for? the apimachinery dependency is on 1.17 so having this on 1.14 may cause strange problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it. not sure how it was added.
pkg/gce-pd-csi-driver/node.go
Outdated
@@ -316,7 +326,8 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage | |||
return &csi.NodeStageVolumeResponse{}, nil | |||
} | |||
|
|||
err = ns.Mounter.FormatAndMount(devicePath, stagingTargetPath, fstype, options) | |||
//err = ns.Mounter.FormatAndMount(devicePath, stagingTargetPath, fstype, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
return err | ||
} | ||
if exists { | ||
return proxy.Unmount(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to unmount if it's already mounted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment. actually it is to remove the dir, not a real unmount like linux. I think could change the name if it is more clear.
// Call the LinkPath CSI proxy from the source path to the target path | ||
parentDir := filepath.Dir(target) | ||
if _, err := os.Stat(target); !os.IsNotExist(err) { | ||
os.RemoveAll(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally we try to avoid calling RemoveAll because we had cases in the past where the volume was still mounted, and RemoveAll ended up deleting user data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, it is removed because preparePublishPath did it
return nil | ||
} | ||
|
||
func normalizeWindowsPath(path string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some unit tests for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually mount utility already has the exact function and has unit test for it. I replace it with mount utitliy's one.
go.mod
Outdated
github.com/google/uuid v1.1.1 | ||
github.com/hashicorp/go-multierror v1.0.0 // indirect | ||
github.com/kubernetes-csi/csi-proxy/client v0.0.0-20200319061913-d6ab31300107 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can actually use the real tag version, but we need add a special tag to the csi-proxy repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work on it.
I tried to addressed most the comments, working on adding unit test. |
24c7280
to
fb989b6
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jingxu97, msau42 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Minor nits
Could you also add your GitHub handle to the remaining TODOs (also a nit :) )?
if err != nil { | ||
return err | ||
} | ||
// TODO: Check if the volume is formatted by calling IsVolumeFormatted CSI proxy call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not needed. removed it.
|
||
} | ||
|
||
// formatAndMount - accepts the source disk number, target path to mount, the fstype to format with and options to be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you mention that it mounts to the host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
This PR adds the support for gcepd driver to work on Windows node. The driver will call csi-proxy API to perform file, volume and disk operations.
/lgtm |
This PR adds the support for gcepd driver to work on Windows node. The
driver will call csi-proxy API to perform file, volume and disk
operations.
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: