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

Cleaned enable pvc datasource #76913

Merged

Conversation

j-griffith
Copy link
Contributor

@j-griffith j-griffith commented Apr 22, 2019

This enables the ability to specify and existing PVC as a DataSource in
a new PVC Spec (eg "clone" and existing volume).

What type of PR is this?

/kind feature

What this PR does / why we need it:

Currently the only valid input Kind for PVC DataSource is "VolumeSnapshot", this feature adds the ability to also specify a DataSource Kind of "PersistentVolumeClaim".

This results in the ability for a user to specify intent to clone and existing PVC, it does NOT implement cloning functionality in Kubernetes; that's left to the external csi provisioner and plugins. It does however provide a mechanism to request a clone operation to the csi-provisioner and ultimately the csi plugin that the original PVC is allocated from.

Currently (as of 1.14) a user is able to enter a DataSource with any information they wish, however if it's not of the type "VolumeSnapshot" and the "VolumeSnapshotDataSource" feature gate is not enabled, the input is nilled and silently ignored. This change follows the same pattern, via the "VolumeDataSource" feature gate.

Which issue(s) this PR fixes:

Implements enhancement/KEP 642
Issue kubernetes/enhancements#989

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

This change enables a user to specify a DataSource/Kind of type "PersistentVolumeClaim" in their PVC spec.  This can then be detected by the external csi-provisioner and plugins if capable.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 22, 2019
@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/apps Categorizes an issue or PR as relevant to SIG Apps. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 22, 2019
@j-griffith
Copy link
Contributor Author

j-griffith commented Apr 22, 2019

/assign @msau42 @jsafrane

@j-griffith
Copy link
Contributor Author

This supersedes #76913

@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@fejta-bot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/check-cla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 23, 2019
@@ -504,6 +510,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
NodeLease: {Default: true, PreRelease: utilfeature.Beta},
SCTPSupport: {Default: false, PreRelease: utilfeature.Alpha},
VolumeSnapshotDataSource: {Default: false, PreRelease: utilfeature.Alpha},
VolumePVCDataSource: {Default: false, PreRelease: utilfeature.Alpha},
Copy link
Contributor

Choose a reason for hiding this comment

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

On a second thought, I think "PVCDataSource" is better. We can't drop "Volume" from "VolumeSnapshotDataSource" because a snapshot could be for something else such as a database.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that naming gets ugly 👍

@j-griffith j-griffith force-pushed the cleaned_enable_pvc_datasource branch from 2199b6f to 8f2b9a9 Compare April 23, 2019 16:18
@xing-yang
Copy link
Contributor

My comment is addressed. LGTM

@jsafrane
Copy link
Member

LGTM from my side.

There is a small change in types.go, an already existing field is extended and its documentation is updated. Let's start formal review, it can be always shortened.

/label api-review
/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 30, 2019
@msau42
Copy link
Member

msau42 commented May 3, 2019

/assign @saad-ali

@humblec
Copy link
Contributor

humblec commented May 3, 2019

lgtm from my side . Thanks @j-griffith !

@jsafrane jsafrane added the api-review Categorizes an issue or PR as actively needing an API review. label May 9, 2019
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 9, 2019
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2019
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

What bad things happen if we let users put whatever they want in this field and have the provisioners be responsible for checking the flag gate and eventing "not supported" ?

@@ -52,3 +52,20 @@ func volumeSnapshotDataSourceInUse(oldPVCSpec *core.PersistentVolumeClaimSpec) b
}
return false
}

func dataSourceIsEnabled(pvcSpec *core.PersistentVolumeClaimSpec) bool {
if pvcSpec.DataSource != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need this level of checking? I mean, is it possible that external controllers could consume this with other types that we don't know about here?

Copy link
Contributor Author

@j-griffith j-griffith May 30, 2019

Choose a reason for hiding this comment

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

IMO no, in fact I thought it seemed redundant and had initially just removed the restrictions on the datasource field with a new feature gate and called it done. Yes, my thought was this was designed for external controllers and I'd love to be able to use it as such. During conversations I was asked to add the checks back in.

I'm probably not helping myself out here.

// If the provisioner does not support VolumeSnapshot data source, volume will
// This field can be used to specify either:
// * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot)
// * An existing PVC (""/PersistentVolumeClaim)
Copy link
Member

Choose a reason for hiding this comment

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

whats with teh quotes?

Copy link
Contributor Author

@j-griffith j-griffith May 30, 2019

Choose a reason for hiding this comment

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

Oops, fixed.

@j-griffith
Copy link
Contributor Author

What bad things happen if we let users put whatever they want in this field and have the provisioners be responsible for checking the flag gate and eventing "not supported" ?

@thockin Not much really, either it does "nothing" because there isn't another controller looking for it or acting upon it, or said entry is valid and it's acted upon (or rejected) by the interested controller.

@thockin
Copy link
Member

thockin commented May 30, 2019

I'm fine with this for alpha, but it seems like the final state is that the provisioner is responsible for evaluating this and deciding whether it supports the source or not (and in fact, already not all provisioners will support all sources or even support any source at all, right)?

I leave it to you and SIG (@saad-ali and @msau42 assigned here) to decide, but I will approve as-is.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: j-griffith, saad-ali, thockin

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 30, 2019
@saad-ali
Copy link
Member

What bad things happen if we let users put whatever they want in this field and have the provisioners be responsible for checking the flag gate and eventing "not supported" ?

The idea was to start off strict and loosen over time: only allow specific datasources initially, and loosen over time to eventually allow arbitrary datasources. In order to support aribitrary datasources we want to formalize the idea of "populators" independent of "provisioners". We haven't gotten that far yet, so for now we're just slightly loosening, instead of allowing anything.

@k8s-ci-robot
Copy link
Contributor

@j-griffith: you cannot LGTM your own PR.

In response to this:

/LGTM

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@saad-ali
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2019
This enables the ability to specify and existing PVC as a DataSource in
a new PVC Spec (eg "clone" and existing volume).
Update the unit tests to include checks for incorrect APIGroup type in
PVC DataSource and change the name of the feature gate to be more clear:
s/VolumeDataSource/VolumePVCDataSource/
This enables the ability to specify and existing PVC as a DataSource in
a new PVC Spec (eg "clone" and existing volume).
@j-griffith j-griffith force-pushed the cleaned_enable_pvc_datasource branch from f57bcbb to 62a4861 Compare May 31, 2019 12:08
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2019
@j-griffith
Copy link
Contributor Author

j-griffith commented May 31, 2019

@saad-ali I had to rebase; shouldn't be anything else added if you could reapply lgtm

@jsafrane
Copy link
Member

/lgtm
just restoring after rebase

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2019
@k8s-ci-robot k8s-ci-robot merged commit 82bfa66 into kubernetes:master May 31, 2019
@janetkuo janetkuo added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed sig/apps Categorizes an issue or PR as relevant to SIG Apps. labels Jun 6, 2019
@liggitt liggitt added this to the v1.15 milestone Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. 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. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Status: API review completed, 1.15
Development

Successfully merging this pull request may close these issues.