-
-
Notifications
You must be signed in to change notification settings - Fork 4
chore: Version CRD #661
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
Merged
Merged
chore: Version CRD #661
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f9bea09 to
e9d201c
Compare
6e061f2 to
e319f4b
Compare
76 tasks
This makes way for the versioned module we will soon introduce
At this point, errors will appear in any crates using the crd. It has only been done separately to illustrate the ease in versioning a CRD without all of the other necessary changes.
This is helpful for later crd version sharing substructures that might not change. For example: v1alpha2::OpaCluster might still use user_info_fetcher::v1alpha1::Config, or perhaps it uses user_info_fetcher::v1beta1::Config. Similarly, shared structures from stackable-operators can then be versioned in the same way.
The versioned module is imported rather than the individual structs and enums (when there is no conflict, eg: if also importing a versioned shared struct) so that that usages show the version explicitly. There might be times where this isn't possible, for example, once structs and enums are versioned in stackable-operator, there could be multiple modules with the same name. In this case, user-info-fetcher is also versioned with v1alpha1, so it is referred to as user_info_fetcher::v1alpha1 in crd/mod.rs so as to not conflict with the crds v1alpha1.
Co-authored-by: Techassi <git@techassi.dev>
e319f4b to
d72ad6f
Compare
Techassi
approved these changes
Feb 5, 2025
This was referenced Feb 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Part of stackabletech/issues#642.
Note
This PR serves as a model for how to convert CRD definitions to stackable-versioned CRDs.
See the explanation of the commits below, and also see the extended commit messages.
crdworkspace member crate to be a module of theoperator-binarymember crate. Runcargo checkto make sure everything is fine before continuing.user-info-fetcher), then export it via alib.rsin theoperator-binarycrate.stackable-versioned.user_info_fetchertypes that are used from the main CRD.v1alpha1::Foo, rather than justFooto make is clear).In some cases this might not be possible, for example if you needed both
crd::v1alpha1andcrd::user_info_fetcher::v1alpha1imported - they would conflict. In that case, importcrd::v1alpha1for the crd, andcrd::user_info_fetcher(without the version module) for the other. The code would then use types qualified like:v1alpha1::Fooanduser_info_fetcher::v1alpha1::Bar.You can search for
///.*\[Tip
A separate PR will show how to make changes to versioned types.