Regenerate your project with (alpha generate
)
Overview
The kubebuilder alpha generate
command re-scaffolds your project using the currently installed
CLI and plugin versions.
It regenerates the full scaffold based on the configuration specified in your PROJECT file. This allows you to apply the latest layout changes, plugin features, and code generation improvements introduced in newer Kubebuilder releases.
You may choose to re-scaffold the project in-place (overwriting existing files) or in a separate directory for diff-based inspection and manual integration.
When to Use It?
You can use kubebuilder alpha generate
to upgrade your project scaffold when new changes are introduced
in Kubebuilder. This includes updates to plugins (for example, go.kubebuilder.io/v3
→ go.kubebuilder.io/v4
)
or the CLI releases (for example, 4.3.1 → latest) .
This command is helpful when you want to:
- Update your project to use the latest layout or plugin version
- Regenerate your project scaffold to include recent changes
- Compare the current scaffold with the latest and apply updates manually
- Create a clean scaffold for reviewing or testing changes
Use this command when you want full control of the upgrade process.
It is also useful if your project was created with an older CLI version and does not support alpha update
.
This approach allows you to compare changes between your current branch and upstream scaffold updates (e.g., from the main branch), and helps you overlay custom code atop the new scaffold.
How to Use It?
Upgrade your current project to CLI version installed (i.e. latest scaffold)
kubebuilder alpha generate
After running this command, your project will be re-scaffolded in place. You can then compare the local changes with your main branch to see what was updated, and re-apply your custom code on top as needed.
Generate Scaffold to a New Directory
Use the --input-dir
and --output-dir
flags to specify input and output paths.
kubebuilder alpha generate \
--input-dir=/path/to/existing/project \
--output-dir=/path/to/new/project
After running the command, you can inspect the generated scaffold in the specified output directory.
Flags
Flag | Description |
---|---|
--input-dir | Path to the directory containing the PROJECT file. Defaults to CWD. Deletes all files except .git and PROJECT . |
--output-dir | Directory where the new scaffold will be written. If unset, re-scaffolds in-place. |
--plugins | Plugin keys to use for this generation. |
-h, --help | Show help for this command. |