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 FromFile and FromExistingClassName support for SnapshotClass in external storage e2e test #88669
Conversation
This will allow users to pass user defined SnapshotClass like below way.
Note that due to the change in SnapshotClass in v1.17, we need to back port this PR to v1.16 or prior and run back ported version of e2e binary, if e2e test is required for v1.16 or prior. (E2E test binary for certain version creates SnapshotClass for the API of its binary version, not k8s cluster's version. So, running latest e2e binary in older k8s cluster won't work if there's API incompatibility.) |
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
/lgtm |
/retest |
Thanks for doing this. /lgtm |
// | ||
// This can be used when the snapshot class is meant to have | ||
// additional parameters. | ||
FromFile 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 also add a "From Existing" option, similar to Storage Class above?
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.
Good suggestion. I will work on it.
cab843a
to
cd9f54a
Compare
Added FromExistingClassName for SnapshotClass. It works like below way. PTAL
Note that:
|
/retest |
/lgtm |
snapshotGVR = schema.GroupVersionResource{Group: snapshotGroup, Version: "v1beta1", Resource: "volumesnapshots"} | ||
snapshotClassGVR = schema.GroupVersionResource{Group: snapshotGroup, Version: "v1beta1", Resource: "volumesnapshotclasses"} | ||
snapshotContentGVR = schema.GroupVersionResource{Group: snapshotGroup, Version: "v1beta1", Resource: "volumesnapshotcontents"} | ||
SnapshotGVR = schema.GroupVersionResource{Group: snapshotGroup, Version: "v1beta1", Resource: "volumesnapshots"} |
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.
Exported symbols must be documented (https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/88669/pull-kubernetes-verify/1233549485305499653).
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.
Thank you for pointing it out. Fixed.
Resolved merge conflict. |
/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 |
case d.SnapshotClass.FromName: | ||
snapshotter := d.DriverInfo.Name | ||
parameters := map[string]string{} | ||
ns := config.Framework.Namespace.Name |
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 have all 3 cases use GetSnapshotClass
so that they all use the same ns and suffix formats?
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 also thought that it would be nice to do so, after I wrote my last comment.
However, to do so, we need to get parameters
from *unstructured.Unstructured
. Is there a good way to achieve it? I couldn't find a good way from here.
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 something like this work?
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 and rebased. PTAL
snapshotter := d.DriverInfo.Name | ||
parameters := map[string]string{} | ||
ns := config.Framework.Namespace.Name | ||
suffix := snapshotter + "-vsc" |
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.
suffix should just be "-vsc"?
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, it came from the original code. And it could be both, because it adds ns
to suffix inside GetSnapshotClass
to be unique. (If there will be a test case that creates multiple SnapshotClass, it's safe to keep snapshotter
, though.)
"name": ns + "-" + suffix, |
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.
Thank you for your review.
I'll change both if you prefer and tell me how on getting parameters
.
case d.SnapshotClass.FromName: | ||
snapshotter := d.DriverInfo.Name | ||
parameters := map[string]string{} | ||
ns := config.Framework.Namespace.Name |
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 also thought that it would be nice to do so, after I wrote my last comment.
However, to do so, we need to get parameters
from *unstructured.Unstructured
. Is there a good way to achieve it? I couldn't find a good way from here.
snapshotter := d.DriverInfo.Name | ||
parameters := map[string]string{} | ||
ns := config.Framework.Namespace.Name | ||
suffix := snapshotter + "-vsc" |
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, it came from the original code. And it could be both, because it adds ns
to suffix inside GetSnapshotClass
to be unique. (If there will be a test case that creates multiple SnapshotClass, it's safe to keep snapshotter
, though.)
"name": ns + "-" + suffix, |
…xternal storage e2e test
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mkimuram, msau42, pohly 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 |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR is to add a feature to pass parameters to SnapshotClass in e2e test via
FromFile
option. This is needed for CSI drivers to pass parameters like secret to SnapshotClass.Which issue(s) this PR fixes:
Fixes #88668
Special notes for your reviewer:
/sig storage
/sig testing
cc @pohly @wongma7 @xing-yang @oomichi
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: