Skip to content

Make sampleexternalplugin a Valid Reference Implementation #4824

Open
@camilamacedo86

Description

@camilamacedo86

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 or create 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 from PROJECT using the same APIs as native plugins
    • Generate scaffolding through the Universe pattern as expected
  • Replace mock scaffolding with real integration
    If create api or create webhook are kept, the plugin should scaffold real config, or invoke go.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.
  • Support config-driven workflows
    Use values from PROJECT instead of hardcoded values or CLI-only inputs

  • Use the local Kubebuilder repo code
    Switch the go.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 drop create api in favor of a more realistic integration path like edit.


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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions