-
Notifications
You must be signed in to change notification settings - Fork 62
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: v1 api #544
chore: v1 api #544
Conversation
Codecov Report
@@ Coverage Diff @@
## main #544 +/- ##
=======================================
Coverage 15.22% 15.22%
=======================================
Files 13 13
Lines 1511 1511
=======================================
Hits 230 230
Misses 1255 1255
Partials 26 26
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
f97fd49
to
252145c
Compare
481ac6d
to
f5e49c8
Compare
9ca9e92
to
dfd8a0e
Compare
Rebased on main and ready for review! |
723e6ae
to
cda2ab9
Compare
In order to create the v1 api for eraser, a number of additional changes had to be made. Our eraser-tooling image had to be modified to include the `conversion-gen` tool. This is to generate type conversions between the older `v1alpha1` API and the newer `v1`. To facilitate conversion between the two, an `unversioned` api was created. This becomes a common hub between `v1` and `v1alpha1` and facilitates conversion. It also makes it easier for our code: with the `unversioned` api, we no longer need to update large swaths of code when a new api version is introduced. In order to get the `conversion-gen` tool to work, I needed to add several magic comments throughout the api code. Most importantly, I needed to add a `doc.go` file to each of the api version directories. `conversion-gen` looks for this file and will not work without it. Above the package name in those files, I added the following two magic comments: ``` +// +k8s:conversion-gen=github.com/Azure/eraser/api/unversioned +// -external-types=github.com/Azure/eraser/api/v1 ``` This tells `conversion-gen` to use the `unversioned` api as the conversion hub. To skip kubebuilder processing the `unversioned` api, `+kubebuilder:skip` had to be added before the package declaration. To specify which api version should be stored in etcd, the `+kubebuilder:storageversion` comment was added to the `v1` types. In addition, `kubebuilder:deprecatedversion:warning="v1alpha1 of the eraser API has been deprecated"` was added to the `v1alpha1` API in order to warn the user to upgrade. In the `groupversion_info.go` file of each version directory, I had to add the line ```go localSchemeBuilder = runtime.NewSchemeBuilder(SchemeBuilder.AddToScheme) ``` To be perfectly honest, I'm not sure what this does, but it is required for the `conversion-gen` process to generate working code. Finally, a new file was added to `test/e2e/test-data` which deploys an imagelist using the new API version. One of the tests was updated to use this file instead. Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
In order to avoid changing the Makefile every time a new version is added, add an empty package to the `./api` directory in order to use the `...` wildcard. Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
This flag will no longer be needed, because we have reduced the size of the CRDs. Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
cda2ab9
to
f16077c
Compare
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
32a985b
to
d660b13
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.
Thank you! LGTM
looks like we might need a final |
Signed-off-by: Peter Engelbert <pmengelbert@gmail.com>
Create v1 api
In order to create the v1 api for eraser, a number of additional changes had to be made.
Our eraser-tooling image had to be modified to include the
conversion-gen
tool. This is to generate type conversions between the olderv1alpha1
API and the newerv1
.To facilitate conversion between the two, an
unversioned
api was created. This becomes a common hub betweenv1
andv1alpha1
and facilitates conversion. It also makes it easier for our code: with theunversioned
api, we no longer need to update large swaths of code when a new api version is introduced.In order to get the
conversion-gen
tool to work, I needed to add several magic comments throughout the api code. Most importantly, I needed to add adoc.go
file to each of the api version directories.conversion-gen
looks for this file and will not work without it. Above the package name in those files, I added the following two magic comments:This tells
conversion-gen
to use theunversioned
api as the conversion hub.To skip kubebuilder processing the
unversioned
api,+kubebuilder:skip
had to be added before the package declaration. To specify which api version should be stored in etcd, the+kubebuilder:storageversion
comment was added to thev1
types. In addition,kubebuilder:deprecatedversion:warning="v1alpha1 of the eraser API has been deprecated"
was added to thev1alpha1
API in order to warn the user to upgrade.In the
groupversion_info.go
file of each version directory, I had to add the lineTo be perfectly honest, I'm not sure what this does, but it is required for the
conversion-gen
process to generate working code.Finally, a new file was added to
test/e2e/test-data
which deploys an imagelist using the new API version. One of the tests was updated to use this file instead.Signed-off-by: Peter Engelbert pmengelbert@gmail.com