Kubebuilder v1 vs v2 (Legacy v1.0.0+ to v2.0.0 Kubebuilder CLI versions)
This document cover all breaking changes when migrating from v1 to v2.
The details of all changes (breaking or otherwise) can be found in controller-runtime, controller-tools and kubebuilder release notes.
V2 project uses go modules. But kubebuilder will continue to support
go 1.13 is out.
Client.Listnow uses functional options (
List(ctx, list, ...option)) instead of
List(ctx, ListOptions, list).
Client.DeleteAllOfwas added to the
Metrics are on by default now.
A number of packages under
pkg/runtimehave been moved, with their old locations deprecated. The old locations will be removed before controller-runtime v1.0.0. See the godocs for more information.
Automatic certificate generation for webhooks has been removed, and webhooks will no longer self-register. Use controller-tools to generate a webhook configuration. If you need certificate generation, we recommend using cert-manager. Kubebuilder v2 will scaffold out cert manager configs for you to use -- see the Webhook Tutorial for more details.
builderpackage now has separate builders for controllers and webhooks, which facilitates choosing which to run.
The generator framework has been rewritten in v2. It still works the same as before in many cases, but be aware that there are some breaking changes. Please check marker documentation for more details.
Kubebuilder v2 introduces a simplified project layout. You can find the design doc here.
In v1, the manager is deployed as a
StatefulSet, while it’s deployed as a
kubebuilder create webhookcommand was added to scaffold mutating/validating/conversion webhooks. It replaces the
kubebuilder alpha webhookcommand.
distroless/staticinstead of Ubuntu as base image. This reduces image size and attack surface.
v2 requires kustomize v3.1.0+.