Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摉 supplement doc over alpha generate command #3602

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
- [Migration by updating the files](migration/manually_migration_guide_gov3_to_gov4.md)
- [Single Group to Multi-Group](./migration/multi-group.md)

- [Project Upgrade Assistant](./reference/rescaffold.md)

---

- [Reference](./reference/reference.md)
Expand Down
11 changes: 11 additions & 0 deletions docs/book/src/migration/migration_guide_gov3_to_gov4.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ The recommended way to migrate a `go/v3` project is to create a new `go/v4` proj
copy over the API and the reconciliation code. The conversion will end up with a
project that looks like a native go/v4 project layout (latest version).

<aside class="note warning">
<h1>Your Upgrade Assistant: The `alpha generate` command</h1>

To upgrade your project you might want to use the command `kubebuilder alpha generate [OPTIONS]`.
This command will re-scaffold the project using the current Kubebuilder version.
You can run `kubebuilder alpha generate --plugins=go/v4` to regenerate your project using `go/v4`
based in your [PROJECT][project-file] file config.

</aside>

However, in some cases, it's possible to do an in-place upgrade (i.e. reuse the go/v3 project layout, upgrading
the PROJECT file, and scaffolds manually). For further information see [Migration from go/v3 to go/v4 by updating the files manually][manually-upgrade]

Expand Down Expand Up @@ -148,3 +158,4 @@ fine.
[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime/releases
[multi-group]: multi-group.md
[manually-upgrade]: manually_migration_guide_gov3_to_gov4.md
[project-file]: ../reference/project-config.md
40 changes: 36 additions & 4 deletions docs/book/src/reference/rescaffold.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# Rescaffold Command
# Project Upgrade Assistant

## Overview

The Kubebuilder CLI provides a new experimental helper `alpha generate` command to re-scaffold an existing project from the scratch using the current version of KubeBuilder binary available based on PROJECT config file.
Please note that all input utilized via the Kubebuilder tool is tracked in the PROJECT file ([example][example]).
This file is responsible for storing essential information, representing various facets of the Project such as its layout,
plugins, APIs, and more. ([More info][more-info]).

With the release of new plugin versions/layouts or even a new Kubebuilder CLI version with scaffold changes,
an easy way to upgrade your project is by re-scaffolding. This process allows users to employ tools like IDEs to compare
changes, enabling them to overlay their code implementation on the new scaffold or integrate these changes into their existing projects.

## When to use it ?

This command is useful when you want to upgrade an existing project to the latest version of the Kubebuilder project layout. It makes it easier for the users to migrate their operator projects to the new scaffolding.
This command is useful when you want to upgrade an existing project to the latest version of the Kubebuilder project layout.
It makes it easier for the users to migrate their operator projects to the new scaffolding.

## How to use it ?

**To upgrade the scaffold of your project to use a new plugin version:**

```sh
kubebuilder alpha generate --plugins="pluginkey/version"
```

**To upgrade the scaffold of your project to get the latest changes:**

Currently, it supports two optional params, `input-dir` and `output-dir`.

`input-dir` is the path to the existing project that you want to re-scaffold. Default is the current working directory.
Expand All @@ -18,4 +33,21 @@ Currently, it supports two optional params, `input-dir` and `output-dir`.

```sh
kubebuilder alpha generate --input-dir=/path/to/existing/project --output-dir=/path/to/new/project
```
```

<aside class="note warning">
<h1>Regarding `input-dir` and `output-dir`:</h1>

If neither `input-dir` nor `output-dir` are specified, the project will be regenerated in the current directory.
This approach facilitates comparison between your current local branch and the version stored upstream (e.g., GitHub main branch).
This way, you can easily overlay your project's code changes atop the new scaffold.

</aside>

## Further Resources:

- Check out [video to show how it works](https://youtu.be/7997RIbx8kw?si=ODYMud5lLycz7osp)
- See the [desing proposal documentation](../../../../designs/helper_to_upgrade_projects_by_rescaffolding.md)

[example]: ./../../../../testdata/project-v4-with-deploy-image/PROJECT
[more-info]: ./../reference/project-config.md
Loading