-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Modernize the Velero code base #2597
Comments
@vmware-tanzu/velero-maintainers PTAL. |
@nrb / @ashish-amarnath: I'm thinking https://github.com/vmware-tanzu/velero/blob/main/pkg/controller/backup_tracker.go, even though is in the |
By far, there are several controllers and CRDs not converted yet, including:
|
Hopefully we makes it to kubebuilder/v3 layout |
Do you mean changing the layout to something like this project? Could you give some scenarios that need the change? Or What benefit do we get from the change? |
The benefit would be we can use kubebuilder CLI from now on to generate new API and controllers boilerplate code https://book.kubebuilder.io/migration/legacy/migration_guide_v1tov2.html |
Specifically we should be able to call
And get boilerplate code for a new controller done automatically. And any future migrations should be simple as there are already many projects using the v3 layout. In addition it standardizes the project to a layout that is more common to a new contributors. |
TODO
v1.5
v1.6
v1.7
v1.8
v1.9
v1.10
v1.11
v1.12
v1.1x
Recipe for converting:
internal
; add unit tests if there are nonekubebuilder
markers in addition to the existing markers (look at previous PRs for examples)_types
to the end of the api file nameNote for developers:
If you get a
" not found"
error when attempting to patch a status, it is very likely a case of the status subresource not being enabled in the CRD. The way to verify this is by runningkubectl get crd $CRDNAME
and then checking if.spec.versions.subresources.status
is set. Here are the usual ways to address this:velero/pkg/apis/velero/v1/backupstoragelocation_types.go
Lines 109 to 110 in c663ce1
make update
v install --crds-only --dry-run -o yaml | kubectl apply -f -
to ensure the updated CRD is re-installed.What
To modernize the Velero code base and tests and bring it more up-to-date and consistent with newer Kubernetes apps, while cleaning up technical debt along the way.
Why
Update: it will also greatly speed up our
make update
,make ci
andmake verify
targets since it will no longer involve generating code when running those.How
The end result will...
kubebuilder
generates as far as files and folder structure, which will make the project look consistent with many other newer projects/appscontroller-runtime
library client to CRUD resources instead of thego-client
library, which is more convoluted by comparisonkubebuilder
/controller-runtime
related test libraries instead of current mocks and action oriented style of testing for controllers, which is a very ineffective and convoluted way to test in the opinions of manycontroller-runtime
examples and best practices for both controller code and tests, which should help us move and consistently keep business logic out of controllers, which is not the case todayStrategy
For this change to work in an incremental manner, we need to be able to CRUD some resources with the existing
go-client
library, and some resources with theruntime-controller
library. This has been accomplished with the PR below, which instantiates theruntime-controller
Manager and uses this manager's client to CRUD the BSL resource:#2561
The idea is to build on this PR and convert one resource/controller at a time. We have 10 resources and 1 (BSL) is done, so that leaves us with 9.
We would leave the backup and restore ones for last, since they are the most involved in terms of logic and tests.
We would start converting the smallest resource/controller, which is the
ServerStatusRequest
, to get an idea of how long it takes to do this work for 1 resource/controller, end-to-end. This would help estimate the reminder of the work.While we work on this transition, we will keep the existing api package/library in its entirety, in case anyone is importing and using this package. Keeping this around is of no cost since it's all generated in an automated way.
For the Velero to transition completely, it would entail removing this (by then) obsolete package, which is a braking change. So we would like to spread this work over the current and next few releases to be able to introduce this change with v2.0.
Vote on this issue!
This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.
The text was updated successfully, but these errors were encountered: