-
Notifications
You must be signed in to change notification settings - Fork 1.4k
✨ feat: add experimental clusterctl convert command
#12843
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
base: main
Are you sure you want to change the base?
✨ feat: add experimental clusterctl convert command
#12843
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Welcome @ramessesii2! |
|
Hi @ramessesii2. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
db40551 to
1bf4039
Compare
clusterctl alpha migrate commandclusterctl migrate command
6f90e35 to
c2050f4
Compare
clusterctl migrate commandclusterctl migrate command
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.
did a quick first pass on migrate.go
please keep the commits squashed to 1 on amends.
c2050f4 to
f67227b
Compare
|
/ok-to-test |
f67227b to
dd58aab
Compare
|
/area clusterctl |
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.
thanks for the updates. i did a bigger pass on the code today.
this is in relatively good shape, but i made some suggestions to re-organize it a bit and make api types opaque to the migrate package.
cmd/clusterctl/cmd/migrate.go
Outdated
|
|
||
| Examples: | ||
| # Migrate from file to stdout | ||
| clusterctl migrate cluster.yaml |
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.
would migrate from new to old be supported?
e.g. v1beta2 -> v1beta1
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'm thinking what are the usecase where a user would downgrade! And even with warnings, there might be data loss while downgrading.
If may suggest, could we please keep it to the scope of the issue as it's already experimental but definitely mark your question.
fabriziopandini
left a comment
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.
@ramessesii2 thanks for this PR and sorry for the delay in the review.
Two main comments from my side
- The code should be structured to support usage of clusterctl as a library
- I would suggest to simplify the code as much as possible, the code target a specific use case and we do not expect to change this code frequently (let's prefer simplicity over extensibility)
See comments for more details; also feel free to pin me in the CAPI channel if you need more clarifications
| func (c *Converter) ConvertResource(info ResourceInfo, obj runtime.Object) ConversionResult { | ||
| gvk := info.GroupVersionKind | ||
|
|
||
| if gvk.Group == clusterv1.GroupVersion.Group && gvk.Version == c.targetGV.Version { |
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.
Am I wrong or this should never happen considering we are calling func this only when dealing with ResourceTypeCoreV1Beta1 objects?
If this is the case, either drop or return an error in this case
(the warning is not actionable for users, because it is surfacing an error in the code)
|
@ramessesii2 Do you have time to address the findings above? |
Hey @sbueringer, sorry for the delay. I've been working on the major refactoring suggested in the reviews. Almost there, I'll push it by EDO |
- Experimental migration support focuses on v1beta1 to v1beta2
conversions for core Cluster API resources
Signed-off-by: Satyam Bhardwaj <[email protected]>
dd58aab to
5303b74
Compare
ramessesii2
left a comment
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've addressed most of the reviews, other might not be applicable post the refactoring.
clusterctl migrate commandclusterctl convert command
- Move to new `Convert` method in clusterctl client interface from
the proposed migrate.
- Create new conversion package with parsing and conversion utilities
- Remove deprecated `migrate` command and related internal migration code
Signed-off-by: Satyam Bhardwaj <[email protected]>
5303b74 to
e2b91c1
Compare
|
@neolit123 @fabriziopandini @sbueringer Thanks for your initial reviews. Based on those, I've refactored code into a new commit. I'll squash it once we're ready to merge or let me know if you prefer that right away. |
|
@ramessesii2: The following test failed, say
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-sigs/prow repository. I understand the commands that are listed here. |
Implements a new
clusterctl convertcommand to convert core CAPI resources i.e.,cluster.x-k8s.ioresources between API versions, currently supporting v1beta1 → v1beta2 migration.✅ Tests
✅ Docs
Implements #12716