diff --git a/docs/book/src/migration/multi-group.md b/docs/book/src/migration/multi-group.md index fd6a15266c6..6fcd1cd4aa6 100644 --- a/docs/book/src/migration/multi-group.md +++ b/docs/book/src/migration/multi-group.md @@ -4,32 +4,32 @@

Note

-Multi-group scaffolding support was not present in the initial version of -the Kubebuilder v2 scaffolding (as of Kubebuilder v2.0.0). +While Kubebuilder will not scaffold out a project structure compatible +with multiple API groups in the same repository by default, it's possible +to modify the default project structure to support it. -To change the layout of your project to support Multi-Group run the command -`kubebuilder edit --multigroup=true`. Once you switch to a multi-group layout, the new Kinds -will be generated in the new layout but additional manual work is needed -to move the old API groups to the new layout. +Note that the process mainly is to ensure that your API(s) and controller(s) will be moved under new directories with their respective group name. -While Kubebuilder v2 will not scaffold out a project structure compatible -with multiple API groups in the same repository by default, it's possible -to modify the default project structure to support it. - Let's migrate the [CronJob example][cronjob-tutorial]. +To change the layout of your project to support Multi-Group run the command +`kubebuilder edit --multigroup=true`. Once you switch to a multi-group layout, the new Kinds +will be generated in the new layout but additional manual work is needed +to move the old API groups to the new layout. + Generally, we use the prefix for the API group as the directory name. We can check `api/v1/groupversion_info.go` to find that out: @@ -38,58 +38,75 @@ can check `api/v1/groupversion_info.go` to find that out: package v1 ``` -Then, we'll rename `api` to `apis` to be more clear, and we'll move our -existing APIs into a new subdirectory, "batch": +Then, we'll rename move our existing APIs into a new subdirectory, "batch": ```bash -mkdir apis/batch -mv api/* apis/batch -# After ensuring that all was moved successfully remove the old directory `api/` -rm -rf api/ +mkdir api/batch +mv api/* api/batch ``` - -After moving the APIs to a new directory, the same needs to be applied to the controllers: +After moving the APIs to a new directory, the same needs to be applied to the controllers. For go/v4: ```bash -mkdir controllers/batch -mv controllers/* controllers/batch/ +mkdir internal/controller/batch +mv internal/controller/* internal/controller/batch/ ``` +