Repository navigation
e2e: make the StorageClass definitions configurable - #10588
Conversation
👷 Deploy request for velero pending review.Visit the deploys page to approve it
|
Signed-off-by: krishhna24 <krishhnatupedev@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
kaovilai
left a comment
There was a problem hiding this comment.
nodeAgentConfigs is initialized before the E2E flags are parsed, so these fields retain the default StorageClass names even when --storage-class and --storage-class-2 are provided. Could we construct this configuration inside Init() after parsing, so the configured values propagate to this test too?
|
Good catch, that literal is evaluated before Re-ran |
|
Really nice work on this one. The creation path catch is the part I'd highlight. Just swapping the constants for flags would have looked fine and been quietly broken, with the specs going off to find the new name while the apply still created The On your question: let's do both follow-ups here rather than splitting them. They're both about what the suite creates, and the flag doesn't buy us much until the first one lands, since pointing it at One suggestion on that first one. Skip-if-exists covers half the problem. For the second, I'd avoid trying to detect which specs need class 2. Flag names look fine to me, no need to churn on those. Thanks for writing up the timings and the before/after comparison in the description, that made this much easier to review. |
Signed-off-by: krishhna24 <krishhnatupedev@gmail.com>
8264903 to
d4ee6a9
Compare
|
Both follow-ups are in, done as ownership like you suggested. If One thing that fell out while wiring it up: the Makefile was passing Ran four cases on kind with
Rebased on main. Description updated to match. |
|
Thanks for working on this! Configuring just the SC names (--storage-class / --storage-class-2) brings up a few tricky issues: it doesn't allow changing the provisioner or parameters, and targeting existing cluster SCs creates complex ownership problems around creation and teardown in BeforeSuite / AfterSuite. Instead of configuring names and adopting existing cluster SCs, what about letting users provide a customized StorageClass manifest (e.g. --storage-class-file)?
This keeps the interface down to a single flag while making E2E lifecycle management much simpler and safer. What do you think? |
|
Thanks, that is a fair point about the provisioner. Renaming cannot change it, which is the gap I flagged in the description: on kind the class is still local-path whatever it is called, so pointing at an existing A manifest flag would solve that more directly, and I agree the lifecycle gets simpler if the suite always creates and deletes what it applied, with no ownership rules at all. The current shape is what @shubham-pampattiwar asked for on this PR, so I would rather you two agree on the interface than have me guess between you. Happy to switch to One thing worth keeping whichever way it goes: |
|
@blackpiglet is right, and I want to be clear that this is me changing my mind rather than @krishhna24 guessing wrong. The ownership model on this PR is there because I asked for it. The thing that convinced me is the provisioner point. Renaming a class cannot change it, so on kind the class stays We do not actually need to adopt anything. We can apply our own class with @krishhna24, sorry for the churn, two rounds on a model we are now dropping. The good news is most of it survives:
Should come out smaller than what is there now. @blackpiglet does that match what you had in mind? |
|
Conflicts here are from #10592, which rewrote Worth flagging: that PR already fixes the creation path this one was carrying. That makes the rework smaller again. With |
|
Please rebase and resolve conflicts @krishhna24 |
The e2e suite creates both of its StorageClasses from the provider's file under testdata/storage-class, so running against a cluster whose volumes need a different provisioner or parameters means editing test data every other job also reads. On kind that is the only way to get a class a CSI driver can snapshot. Take the definition as a flag instead. --storage-class-file and --storage-class-file-2 name a manifest each, and the suite keeps creating and deleting what it applied, so nothing adopts resources it did not make. The class names stay fixed. Every spec refers to e2e-storage-class and e2e-storage-class-2, and CreateStorageClassFromYaml already takes a name override, so only the definition needs to vary. An empty --storage-class-file-2 runs without a second StorageClass, and the three cases that map between two of them skip with a message saying how to enable them. Which specs need it cannot be worked out in BeforeSuite, since the label filter is not visible there yet, so this is expressed as an opt-out rather than detection. Signed-off-by: krishhna24 <krishhnatupedev@gmail.com>
d4ee6a9 to
c7031a9
Compare
|
Rebased. Rather than merging the ownership code and then deleting it, I reset onto main and rebuilt it as the file-based version, so this is one commit and 95 insertions where the old one was 155. Two things main gave us. #10592 added Gates on kind,
I ran that last one because the failure I would expect from this change is a missing file quietly falling back to the provider file, which would leave the flag looking like it worked while testing something else. It does not fall back. One thing I did not manage to drop: |
|
PTAL ! @shubham-pampattiwar @kaovilai |
|
Noticed the title and description here were still the ownership version, which is probably confusing if you opened this expecting what @blackpiglet asked for. Both now match the branch. No code change, still |
kaovilai
left a comment
There was a problem hiding this comment.
It's good. Thank you for your pull request.
|
This test only changes. I think this is safe to merge post FC. |
Addresses the hardcoded e2e StorageClass handling described in #8765.
What changes
--storage-class-fileand--storage-class-file-2, which configure the StorageClass definition rather than its name. Both default totestdata/storage-class/<provider>.yaml, so with neither set the behaviour is exactly as it is today.The class names stay constants. Every spec keeps referring to
e2e-storage-classande2e-storage-class-2, and only the definition varies. That is what lets kind point at ahostpath.csi.k8s.ioclass without any spec knowing about it.An empty
--storage-class-file-2runs without a second StorageClass. Which specs need one cannot be determined inBeforeSuite, since the label filter is not visible yet, so the cases that map between two classes skip with a message naming the flag.Why this shape
The first version of this PR configured the names and adopted classes that already existed in the cluster. @blackpiglet pointed out that a name cannot change the provisioner, which is the thing kind actually needs, and that adopting a pre-existing class is what forces the ownership machinery around
BeforeSuiteandAfterSuite. Applying our own manifest avoids all of it: the suite owns everything it created, teardown stays unconditional, and it matches howvolume-snapshot-classand the VGSClass from #10582 already work, one file per situation.#10592 then landed
CreateStorageClassFromYaml, which takes a yaml path and a name override and is called twice from the same file. That fixed the file-versus-constant coupling inInstallStorageClassesindependently of this PR, and it is why this one is now 96 insertions where the earlier version was 155: noProvidedbooleans, no existence check, no early-fail, andDeleteStorageClassalready swallows NotFound.One thing that did not go away.
STORAGE_CLASS_FILE_2goes through an$(origin)check intest/Makefile, because an empty value means "run without a second class" and a flag that is always passed cannot express "not set". If a separate boolean would be preferred, that is a two line change.Testing
kind v1.36.1, MinIO as the object store, Velero built from this branch,
Basic && (ClusterResource || NodePort || StorageClass)in every case:STORAGE_CLASS_FILEset to a hostpath manifestInstall storage class e2e-storage-class with /tmp/hostpath-sc.yamlthene2e-storage-class-2 with ../testdata/storage-class/kind.yamlSTORAGE_CLASS_FILE_2=this case maps between two StorageClasses; it needs --storage-class-file-2STORAGE_CLASS_FILEset to a path that does not existBeforeSuitein 0.012s withfailed to read storage class yaml /tmp/does-not-exist.yaml: no such file or directoryI ran that last one because the failure I would expect from this change is a missing file quietly falling back to the provider file, which would leave the flag looking like it worked while testing something else. It does not fall back.
make lint,go vet ./test/...andgofmtare clean.Context: this is part of the CSI-on-kind e2e work in #7507.