-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: version the crd #661
Open
NickLarsenNZ
wants to merge
8
commits into
main
Choose a base branch
from
chore/add-crd-versioning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
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.
NickLarsenNZ
force-pushed
the
chore/add-crd-versioning
branch
from
December 5, 2024 09:59
f9bea09
to
e9d201c
Compare
NickLarsenNZ
force-pushed
the
chore/add-crd-versioning
branch
from
December 5, 2024 16:05
c834ee3
to
6e061f2
Compare
Co-authored-by: Techassi <[email protected]>
NickLarsenNZ
force-pushed
the
chore/add-crd-versioning
branch
from
December 5, 2024 16:06
6e061f2
to
e319f4b
Compare
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
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.
crd
workspace member crate to be a module of theoperator-binary
member crate. Runcargo check
to make sure everything is fine before continuing.user-info-fetcher
), then export it via alib.rs
in theoperator-binary
crate.stackable-versioned
.user_info_fetcher
types that are used from the main CRD.v1alpha1::Foo
, rather than justFoo
to make is clear).In some cases this might not be possible, for example if you needed both
crd::v1alpha1
andcrd::user_info_fetcher::v1alpha1
imported - they would conflict. In that case, importcrd::v1alpha1
for the crd, andcrd::user_info_fetcher
(without the version module) for the other. The code would then use types qualified like:v1alpha1::Foo
anduser_info_fetcher::v1alpha1::Bar
.Tip
A separate PR will show how to make changes to versioned types.