-
Notifications
You must be signed in to change notification settings - Fork 217
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
Implement Cloning for csi-hostpath driver #58
Implement Cloning for csi-hostpath driver #58
Conversation
Welcome @j-griffith! |
/assign @jsafrane |
/hold |
pkg/hostpath/controllerserver.go
Outdated
return nil, status.Error(codes.Internal, "source volumeID does not exist, are source/destination in the same storage class?") | ||
} | ||
srcPath := hostPathVolume.VolPath | ||
args := []string{"-r", srcPath + "/*", 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.
Would be -a
more appropriate for 1:1 clone?
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.
Indeed! The one other thing I wanted to check on is handling block mode. Thanks for pointing this out.
pkg/hostpath/controllerserver.go
Outdated
executor := utilexec.New() | ||
out, err := executor.Command("cp", args...).CombinedOutput() | ||
if err != nil { | ||
return nil, status.Error(codes.Internal, fmt.Sprintf("failed pre-populate data (clone) for volume: %v: %s", err, out)) |
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 the driver at least try to delete half-cloned volume on error? Fixing it in the snapshot restore case above would be nice too :-).
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 sure.. I'll update both.
c1bb639
to
2ef1251
Compare
/lgtm why there is hold? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: j-griffith, jsafrane 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 |
@j-griffith, it seems that csi-sanity fails for cloning. |
/lgtm cancel |
There are probably some updates needed there, but we also seem to only have 1.13/14 enabled there; since the code in kubernetes just merged and will be 1.15 I'm not sure (yet) how to pull that in. |
csi-sanity testing is independent of the Kubernetes version. It merely runs against the hostpath driver that got deployed into a Kubernetes cluster. What we have here are simply some failing tests: "can't stat '/csi-data-dir/1a9fcb59-8d35-11e9-aa7d-024285e8710b/*': No such file or directory" and an unexpected error code. It might very well be that the snapshot test is broken. I don't know whether it ever has been run against a driver that implements snapshotting. The error code mismatch looks like something that can be fixed in the hostpath implementation. To reproduce the failure:
Once that has failed, you still have a running cluster in KinD and you can debug manually (re-run the test, update the driver, etc.) To clean up, |
Thanks @pohly I'm looking into it |
@pohly thanks for the hints, the problem is that in the test case the src directory is empty; so the |
2ef1251
to
24c8a43
Compare
Missed one because I was using focused test. |
24c8a43
to
fcf1d14
Compare
/hold cancel |
/retest |
This PR adds support for cloning of hostpath volumes.
fcf1d14
to
959c467
Compare
/lgtm |
This PR adds support for cloning of hostpath volumes.
What type of PR is this?
What this PR does / why we need it:
This PR adds a simple implementation for clone support to the csi-hostpath driver.
Which issue(s) this PR fixes:
Fixes #57
Special notes for your reviewer:
Kubernetes changes have merged in to current master, target for Alpha in 1.15
Sidecar changes are here: kubernetes-csi/external-provisioner#220
Does this PR introduce a user-facing change?: