cluster-api
cluster-api copied to clipboard
✨ clusterctl: Add move --to-folder and --from-folder flags
What this PR does / why we need it:
Changes based on #6992
-
Adds deprecated warning to
clusterctl restoreandclusterctl backup. Example$ clusterctl backup --directory ~/temp/clusterctl-backup/ WARNING: 'clusterctl backup' is deprecated and will be removed in a future release. Use 'clusterctl move' instead. Performing backup... Discovering Cluster API objects Starting backup of Cluster API objects Clusters=1 Moving Cluster API objects ClusterClasses=1 Saving files to /home/oscar/temp/clusterctl-backup/ -
Adds
clusterctl moveflags--to-folderand--from-folder. Example$ clusterctl move --to-folder --directory ~/temp/clusterctl-backup/ Performing backup... Discovering Cluster API objects Starting backup of Cluster API objects Clusters=1 Moving Cluster API objects ClusterClasses=1 Saving files to /home/oscar/temp/clusterctl-backup/ -
I also added they should mutually exclusive with each other.
$ clusterctl move --from-folder --to-folder Error: if any flags in the group [from-folder to-folder] are set none of the others can be; [from-folder to-folder] were all set $ clusterctl move --from-folder --kubeconfig=foo Error: if any flags in the group [from-folder kubeconfig] are set none of the others can be; [from-folder kubeconfig] were all set $ clusterctl move --to-folder --to-kubeconfig=foo Error: if any flags in the group [to-folder to-kubeconfig] are set none of the others can be; [to-folder to-kubeconfig] were all set -
Since
dry-runexists for move but not for restore and backup I added logic to not perform any actions if it's set.$ clusterctl move --to-folder --dry-run Error: please run --to-folder without --dry-run flag $ clusterctl move --from-folder --dry-run Error: please run --from-folder without dry-run flag
Which issue(s) this PR fixes: Fixes #6992
Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all
@oscr: This issue is currently awaiting triage.
If CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
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.
A general question: right now the flags are called --to-folder and --from-folder but the folder is specified with --directory (like in restore and backup). Should we maybe change the names to be consistent?
A general question: right now the flags are called
--to-folderand--from-folderbut the folder is specified with--directory(like in restore and backup). Should we maybe change the names to be consistent?
+1 to using directory instead. We also use directory in the topology dry run cmd
/test pull-cluster-api-e2e-informing-main
/retest
I seem to have broken some tests with my last "improvement". Will make a fix and push soon.
Turns out details are important when programming. I incorrectly replaced a call to Backup as
return c.Move(MoveOptions{
FromKubeconfig: options.FromKubeconfig,
FromDirectory: options.Directory,
Namespace: options.Namespace,
})
But FromDirectory should have been ToDirectory. So big thanks to whoever wrote the test that caught it.
/lgtm
looking forward to lgtm as soon as lint error is fixed great work!
@oscr: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| pull-cluster-api-apidiff-main | 44f9fd9501bd8aa2e5a77597dd9cc02a09af46e4 | link | false | /test pull-cluster-api-apidiff-main |
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.
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. I understand the commands that are listed here.
/lgtm
/approve Yay!
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: fabriziopandini
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [fabriziopandini]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
@ykakarap @fabriziopandini I would like to thank you both for all the help and feedback with this pr. I am grateful for your help :pray: