-
Notifications
You must be signed in to change notification settings - Fork 338
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
Extend allowed DataSources #220
Extend allowed DataSources #220
Conversation
0627c2b
to
979102b
Compare
979102b
to
b9148ef
Compare
63c64c3
to
b5e553f
Compare
4d5f58b
to
0ef237e
Compare
pkg/controller/controller_test.go
Outdated
//var timeNow = time.Now().UnixNano() | ||
//var metaTimeNowUnix = &metav1.Time{ | ||
// Time: time.Unix(0, timeNow), | ||
// } |
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.
@j-griffith can we remove this commented code ?
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.
Oops, yes sorry!
Cleaned up with the rebase, should be good to go. |
0ef237e
to
839edba
Compare
/assign @saad-ali |
if err != nil { | ||
return nil, fmt.Errorf("error getting PVC %s from api server: %v", options.PVC.Spec.DataSource.Name, err) | ||
} | ||
if string(sourcePVC.Status.Phase) != "Bound" { |
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.
@j-griffith I dont know whether this can land on a race , that said, by the time getPVCSource
returns its available/ready
, someone released it or vice versa. @jsafrane thoughts?
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.
Yes, I think that's possible, I guess you'd want to add a shared mutex for the source PVC here?
if *(options.PVC.Spec.DataSource.APIGroup) != snapshotAPIGroup { | ||
return nil, fmt.Errorf("the PVC source does not belong to the right APIGroup. Expected %s, Got %s", snapshotAPIGroup, *(options.PVC.Spec.DataSource.APIGroup)) | ||
|
||
switch options.PVC.Spec.DataSource.Kind { |
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.
@j-griffith we already have a getVolumeContentSource
, can we make use of 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.
Hi @humblec thanks for pointing that out. Actually you'll notice I do utilize that helper function, I added the fetch for PVC to it and call it when we actually pull the content.
This particular check in this section was a here to validate the options and "fail fast" if they were invalid, as well as set a variable so that the provision stage later would have a flag to "getContentSource" or not. If we want to consolidate things into a single helper, that's certainly possible, but it seemed like following the flow we already have for Snapshots was a good idea here.
} | ||
capacity := options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)] | ||
requestedSize := capacity.Value() | ||
if requestedSize < int64(sourcePVC.Spec.Size()) { |
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.
@j-griffith There could be scenarios where resizer
is processing an expansion request in the backend. So, may be checking current PVC's size and capacity could help as well.
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.
Sorry, i'm not sure I follow; what do you mean the "current PVC's size and capacity"? The destination has yet to be created at this stage, so the only object that's relevant is the sourcePVC and the requested size; do you mean a resize in progress on the specified source volume?
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.
do you mean a resize in progress on the specified source volume?
Exactly! thats what I meant, in short, the resizer took the request and working with the driver to get it into desired state.
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.
Shouldn't checking sourcePVC.Spec
alone be sufficient since it will be the largest possible value (it will be the desired size)? Validation prevents setting that value to a smaller value right?
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.
@j-griffith There could be scenarios where
resizer
is processing an expansion request in the backend. So, may be checking current PVC's size and capacity could help as well.
@humblec so I've thought about this a bit; and yes there's certainly a potential for a race here. That being said, we have that condition across other operations already (snapshots for example) and the challenge that's been discussed is coordinating any sort of locking/checks across the different control planes. Not to mention as @jsafrane pointed out, even across CSI provisioner nodes.
Note that this PR does fetch the source PVC object and check its capacity before processing/issuing the provision call, so I think it's doing basically what you're suggesting.
IMO this is a larger problem that needs solved independent of the cloning implementation. Whether that's new phases on the PVC, some other event tracking, or (as I think we've done thus far) the "storage device plugins problem". It sounds like this is something that's been brought up in other context and is being discussed, but we have some long term work to do here I think.
839edba
to
33ea9a5
Compare
33ea9a5
to
1dd93e3
Compare
1dd93e3
to
47c105a
Compare
/retest |
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
/approve
/hold
To give @humblec a chance to review
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: j-griffith, saad-ali 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 as discussed in above review comments (#220 (comment)) i see possibilities of couple of race conditions ( pvc status/capacity..etc) , however these are not really specific to this PR rather its a general problem which we have to address with a thorough design. Lets attack it later in a different discussion/PR. LGTM from my side on this PR . Thanks !! @saad-ali I am good to get this in and thanks for giving chance for final review from my side! |
Thanks @humblec I agree with you, we'll need to consider these in a broader scope. |
/hold cancel |
/retest |
This PR extends the supported DataSources handled by the external-provisioner to include PVCs (Clone). It removes the restriction of of the provisioner erroring when a DataSource.Kind of anything other than VolumeSnapshot is supplied and adds handling for a DataSource.Kind of PersistentVolumeClaim. This implements the ability to specify a clone, and pass that dataSource on to plugins that report support for the capability. Addresses: Issue kubernetes-csi#172
47c105a
to
c7b783a
Compare
Had to update the call I added to NewCSIProvisioner in the test file after rebase. |
/lgtm |
/kind feature |
6613c3980 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae993d Update k8s image repo url 77e47cce8 Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b09 Fix dep version mismatch 8f839056a Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94dd5 Update go version to 1.20 to match k/k v1.27 e322ce5e5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a51209 test: fix golint error aa61bfd0c Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d1963 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171bef0 Merge pull request kubernetes-csi#216 from msau42/process cb9878261 Merge pull request kubernetes-csi#217 from msau42/owners a11216e47 add new reviewers and remove inactive reviewers dd9867540 Add step for checking builds b66c08249 Merge pull request kubernetes-csi#214 from pohly/junit-fixes b9b6763bd filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit d4277839f filter-junit.go: preserve system error log 38e11468f prow.sh: publish individual JUnit files as separate artifacts git-subtree-dir: release-tools git-subtree-split: 6613c3980d1e418bebb7bc49d64c977cfff85671
6613c3980 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae993d Update k8s image repo url 77e47cce8 Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b09 Fix dep version mismatch 8f839056a Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94dd5 Update go version to 1.20 to match k/k v1.27 e322ce5e5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a51209 test: fix golint error aa61bfd0c Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d1963 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171bef0 Merge pull request kubernetes-csi#216 from msau42/process cb9878261 Merge pull request kubernetes-csi#217 from msau42/owners a11216e47 add new reviewers and remove inactive reviewers dd9867540 Add step for checking builds b66c08249 Merge pull request kubernetes-csi#214 from pohly/junit-fixes b9b6763bd filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit d4277839f filter-junit.go: preserve system error log 38e11468f prow.sh: publish individual JUnit files as separate artifacts git-subtree-dir: release-tools git-subtree-split: 6613c3980d1e418bebb7bc49d64c977cfff85671
6613c3980 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae993d Update k8s image repo url 77e47cce8 Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b09 Fix dep version mismatch 8f839056a Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94dd5 Update go version to 1.20 to match k/k v1.27 e322ce5e5 Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a51209 test: fix golint error aa61bfd0c Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d1963 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171bef0 Merge pull request kubernetes-csi#216 from msau42/process cb9878261 Merge pull request kubernetes-csi#217 from msau42/owners a11216e47 add new reviewers and remove inactive reviewers dd9867540 Add step for checking builds b66c08249 Merge pull request kubernetes-csi#214 from pohly/junit-fixes b9b6763bd filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit d4277839f filter-junit.go: preserve system error log 38e11468f prow.sh: publish individual JUnit files as separate artifacts git-subtree-dir: release-tools git-subtree-split: 6613c3980d1e418bebb7bc49d64c977cfff85671
Add CHANGELOG for v2.2.0
6613c398 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update 0e7ae993 Update k8s image repo url 77e47cce Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version 155854b0 Fix dep version mismatch 8f839056 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update 1d3f94dd Update go version to 1.20 to match k/k v1.27 e322ce5e Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error b74a5120 test: fix golint error aa61bfd0 Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver 7563d196 Update CSI_PROW_DRIVER_VERSION to v1.11.0 a2171bef Merge pull request kubernetes-csi#216 from msau42/process cb987826 Merge pull request kubernetes-csi#217 from msau42/owners a11216e4 add new reviewers and remove inactive reviewers dd986754 Add step for checking builds b66c0824 Merge pull request kubernetes-csi#214 from pohly/junit-fixes b9b6763b filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit d4277839 filter-junit.go: preserve system error log 38e11468 prow.sh: publish individual JUnit files as separate artifacts git-subtree-dir: release-tools git-subtree-split: 6613c3980d1e418bebb7bc49d64c977cfff85671
This PR extends the supported DataSources handled by the
external-provisioner to include PVCs (Clone) and Populators (external
CRDs).
It removes the restriction of of the provisioner erroring when a
DataSource.Kind of anything other than VolumeSnapshot is supplied (the
Kubernetes API currently enforces this anyway via it's verifictaion
checks) and adds handling for a DataSource.Kind of
PersistentVolumeClaim.
Addresses: Issue #172
Does this PR introduce a user-facing change?: