-
Notifications
You must be signed in to change notification settings - Fork 57
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
feat: bump up CRD version to v1beta1 #664
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #664 +/- ##
=======================================
Coverage 44.51% 44.51%
=======================================
Files 56 56
Lines 3266 3266
=======================================
Hits 1454 1454
Misses 1664 1664
Partials 148 148
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
0e8f912
to
e6ed5a1
Compare
instead of this being a breaking change, you should consider creating a seperate v1beta1 api and converting between different versions https://book.kubebuilder.io/multiversion-tutorial/tutorial.html |
e6ed5a1
to
2886031
Compare
2886031
to
817b8dd
Compare
817b8dd
to
e69c5b2
Compare
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 PR binbin. Left some questions
b396290
to
7db663c
Compare
f656593
to
a54990d
Compare
a54990d
to
3a3edb5
Compare
Complete(r) | ||
} | ||
|
||
// Creates a store reference from CRD spec and add store to map | ||
func storeAddOrReplace(spec configv1alpha1.StoreSpec, fullname string) error { | ||
func storeAddOrReplace(spec configv1beta1.StoreSpec, fullname string) error { |
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 don't see usage of unversioned. if it's not a specific Kubernetes API reference, you should use unversioned API
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.
Actually in controller, the Store
object is retrieved from K8s Cluster which should be a valid version. https://github.com/deislabs/ratify/blob/main/pkg/controllers/store_controller.go#L64
So I use the v1beta1 version across the controller file, for other files we should definitely use unversioned API but there is no usage yet.
And for this specific function, we could probably do a manual conversion from v1beta1 to unversioned once we retrieved object from the cluster.
e2913aa
to
7c6ed6a
Compare
20d7e2d
to
9224321
Compare
9224321
to
631a4c7
Compare
9137883
to
d7f314f
Compare
d7f314f
to
43ca16c
Compare
Description
What this PR does / why we need it:
Update CRD version from v1alpha1 to v1beta1.
Basically I followed this example, API conversion guide and this example to make the upgrade. For the hub-spoke conversion code, I use conversion-gen to auto-generate it.
Added a doc listing the steps of the upgrade.
Steps for the upgrade:
kubebuilder create api --group config.ratify.deislabs.io --version v1beta1 --kind <kind>
v1alpha1
andv1beta1
to faciliate conversion. When we add a new V1 version, it would be convenient to generate conversion functions betweenv1
andunversioned
.+k8s:conversion-gen
directive pointing to the “hub” version package. It must be in doc.go.localSchemeBuilder = runtime.NewSchemeBuilder(SchemeBuilder.AddToScheme)
ingroupversion_info.go
so the auto-generated code would compile.+kubebuilder:object:generate=true
+kubebuilder:skip
tounversioned
api.v1beta1
as the storage version, add marker+kubebuilder:storageversion
tov1beta1
.make manifests generate
to generate CRD objects, DeepCopy and conversion methods.Notes:
in this pr, we didn't make any changes to the CRD properties. In the future, if we have incompatible changes, we would have to Add
{kind}_conversion.go
in each version to implementConvertible
for each type.Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when the PR gets merged):Fixes #602
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Test passed. Tested locally with v1alpha1 CR as well.
Checklist: