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 cloning via PVC annotation #183

Merged
merged 1 commit into from
May 25, 2018

Conversation

aglitke
Copy link
Contributor

@aglitke aglitke commented May 22, 2018

This PR enables provisioning new volumes as a clone of an existing PVC. To
request a clone, the user should add a clone request annotation to the PVC:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: clone-claim
  annotations:
    k8s.io/CloneRequest: default/source-pvc

The provisioner will locate the indicated PVC and determine the underlying
associated cinder volume ID. The provisioner will use this ID as the
source-vol-id parameter when provisioning the new volume resulting in a clone
at the storage level.

Cloning will only work if the cinder backend supports "smart-cloning". This
means that the clone will complete without the need for cinder to perform a
bit-for-bit copy using the host. Because of this, the cinder provisioner will
not attempt to clone unless the associated storage class contains the
parameter: "smartclone" to indicate that volumes provisioned from this storage
class can be cloned correctly.

If the provisioner was able to clone the volume it will apply the
'k8s.io/CloneOf' annotation to the PVC.

This patch enables provisioning new volumes as a clone of an existing PVC.  To
request a clone, the user should add a clone request annotation to the PVC:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: clone-claim
  annotations:
    k8s.io/CloneRequest: default/source-pvc

The provisioner will locate the indicated PVC and determine the underlying
associated cinder volume ID.  The provisioner will use this ID as the
source-vol-id parameter when provisioning the new volume resulting in a clone
at the storage level.

Cloning will only work if the cinder backend supports "smart-cloning".  This
means that the clone will complete without the need for cinder to perform a
bit-for-bit copy using the host.  Because of this, the cinder provisioner will
not attempt to clone unless the associated storage class contains the
parameter: "smartclone" to indicate that volumes provisioned from this storage
class can be cloned correctly.

If the provisioner was able to clone the volume it will apply the
'k8s.io/CloneOf' annotation to the PVC.

Signed-off-by: Adam Litke <alitke@redhat.com>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 22, 2018
@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@aglitke
Copy link
Contributor Author

aglitke commented May 22, 2018

/cc @j-griffith

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented May 22, 2018

Build succeeded.

@aglitke
Copy link
Contributor Author

aglitke commented May 23, 2018

/cc @hogepodge
Can you mark this one ok-to-test?

@hogepodge
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 23, 2018
@zetaab
Copy link
Member

zetaab commented May 23, 2018

if the cinder backend supports "smart-cloning" - how I can see does our cinder backend support this? Is this using basically volume clone command?

@aglitke
Copy link
Contributor Author

aglitke commented May 24, 2018

@zetaab The short answer is "depends on the configuration". I define "smart-cloning" as the ability to provision a new volume clone utilizing exclusively the storage backend. When a source volume id is passed into the create verb cinder will request a clone from the backend storage if supported. Otherwise, cinder will perform a host-assisted clone. Host assisted clone is also needed when cloning across volume types. Cinder host-assisted clone will obviously not work well in a kubernetes context so we want to avoid this. This is why this patch requires the smartclone: true parameter to be added to the storage class being serviced by the provisioner to indicate that volumes provisioned in this storage class can be smart-cloned.

@dims
Copy link
Member

dims commented May 25, 2018

/approve
/lgtm

@aglitke please add some notes from here to the docs/

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims

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 May 25, 2018
@k8s-ci-robot k8s-ci-robot merged commit 4156161 into kubernetes:master May 25, 2018
@aglitke aglitke deleted the cinder-cloning branch June 6, 2018 01:14
powellchristoph pushed a commit to powellchristoph/cloud-provider-openstack that referenced this pull request Jan 19, 2022
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.

5 participants