When you scaffold a new project with Kubebuilder, it generates several boilerplate components required for building, configuring, and running your controller. The project structure is divided into build infrastructure, launch configuration, and the application entrypoint.
Build Infrastructure
go.mod: Defines the Go module and its basic dependencies.Makefile: Contains standard Make targets for building, testing, and deploying your controller.PROJECT: A metadata file used by Kubebuilder to track project information for future scaffolding operations.
Launch Configuration
Configuration files are located in the config/ directory and use Kustomize YAML definitions. While initially used for launching the controller, this directory will eventually house your CustomResourceDefinitions (CRDs), RBAC configurations, and WebhookConfigurations.
Key configuration directories include:
config/default: The Kustomize base for launching the controller in a standard configuration.config/manager: Configuration for launching controllers as pods within the cluster.config/rbac: Configuration for the permissions (RBAC) required to run controllers under their own service account.
Entrypoint
main.go: The primary entrypoint for the project where the controller manager is initialized and started.