Description
Problem
The current sampleexternalplugin
is outdated and fails to reflect real-world plugin development practices:
- Does not align with the internal plugin architecture
- Lacks use of the
PROJECT
config for inputs like domain/layout/version - Fails on standard commands like
create webhook
orcreate api
- Contains mock scaffolding logic that isn’t meaningful for operators
- Hard to test locally — imports Kubebuilder from a release module, not the working source
Suggested Improvements
-
Match internal plugin architecture
- Use
config.Config
and read/write fromPROJECT
using the same APIs as native plugins - Generate scaffolding through the
Universe
pattern as expected
- Use
-
Replace mock scaffolding with real integration
Ifcreate api
orcreate webhook
are kept, the plugin should scaffold real config, or invokego.kubebuilder.io/v4
properly.
Preferred: make the plugin useful by integrating a config-generation workflow —- e.g.,
kubebuilder edit --generate-bundle
for OLM/operator distribution - OR generate a Prometheus monitor setup, which is currently embedded in
golang/v4
but could be optional and moved into an external plugin. - Any config that makes sense to be optional (and not in the default scaffold) would be a good candidate.
- e.g.,
-
Support config-driven workflows
Use values fromPROJECT
instead of hardcoded values or CLI-only inputs -
Use the local Kubebuilder repo code
Switch thego.mod
to:replace sigs.k8s.io/kubebuilder/v4 => ../../../../../
This ensures contributors can test the plugin in PRs and local workflows.
-
Add a
go.mod
file
Supports proper CI/testability and makes plugin development easier. -
Update documentation
The example shown in the book should be updated to reflect these changes — particularly if we dropcreate api
in favor of a more realistic integration path likeedit
.
Goal
Turn the sample plugin into a realistic, working, and testable reference:
- Based on how real Kubebuilder plugins work
- Produces meaningful project output (e.g., operator bundles, optional configs like Prometheus monitors or CRD dashboards)
- Helps plugin developers test against local changes and internal APIs
- Keeps docs and examples in sync with real expected usage
- We might start to release this external plugin with Kubebuilder, for example.
We need a full, valid implementation.