Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Varsha <varshaprasad96@gmail.com>
  • Loading branch information
juanluisvaladas and varshaprasad96 authored May 11, 2023
1 parent 041a0ba commit 4307139
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/book/src/migration/multi-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ mv internal/controller/* internal/controller/batch/


Next, we'll need to update all the references to the old package name.
For CronJob, that'll be `main.go` and `controllers/batch/cronjob_controller.go`.
For CronJob, the paths to be replaced would be `main.go` and `controllers/batch/cronjob_controller.go` to their respective locations in the new project structure.

If you've added additional files to your project, you'll need to track down
imports there as well.

Finally, fix the PROJECT file manually, the command `kubebuilder edit --multigroup=true`
sets our project to multigroup, but it doesn't fix the path of the existing APIs.
For each resource need to modify the path and perform no additional modifications.
For each resource we need to modify the path.

For instance, for a file:

Expand Down Expand Up @@ -170,12 +170,12 @@ Replace `path: tutorial.kubebuilder.io/project/api/v1beta1` for
`path: tutorial.kubebuilder.io/project/api/batch/v1beta1`


In this way, if the project is not new and has previous APIs already implemented will be in the previous structure.
Notice that with the `multi-group` project the Kind API's files are
created under `api/<group>/<version>` instead of `api/<version>`.
Also, note that the controllers will be created under `internal/controller/<group>` instead of `internal/controller`.
That is the reason why we moved the previously generated APIs with the provided scripts in the previous steps.
Remember to update the references afterwards.
In this process, if the project is not new and has previous implemented APIs they would still need to be modified as needed.
Notice that with the `multi-group` project the Kind API's files are created under `api/<group>/<version>` instead of `api/<version>`.
Also, note that the controllers will be created under `internal/controller/<group>` instead of `internal/controller`.

That is the reason why we moved the previously generated APIs to their respective locations in the new structure.
Remember to update the references in imports accordingly.

For envtest to install CRDs correctly into the test environment, the relative path to the CRD directory needs to be updated accordingly in each `internal/controller/<group>/suite_test.go` file. We need to add additional `".."` to our CRD directory relative path as shown below.

Expand Down

0 comments on commit 4307139

Please sign in to comment.