Improve hack/docs to avoid failures when upgrading controller-runtime version #4679
Labels
good first issue
Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Currently, all projects generated for documentation/tutorials are created automatically via commands and scripts under
hack/docs
. This automation helps keep our documentation up to date without needing manual intervention.When we run
make generate
, it triggersmake generate-docs
, which re-generates these example projects and syncs them with the documentation.The Problem
We have a hardcoded version of
controller-runtime
in the following line:kubebuilder/hack/docs/internal/cronjob-tutorial/generate_cronjob.go
Line 291 in 3ae9604
This causes
make generate-docs
to fail when we bump the controller-runtime version in the scaffold logic. For example, updating this constant:kubebuilder/pkg/plugins/golang/v4/scaffolds/init.go
Line 43 in 3ae9604
From:
ControllerRuntimeVersion = "v0.20.4"
To a newer version may result in errors like:
ERRO error fixing cronjob_controller.go: string // - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile not found in /* Copyright 2025 The Kubernetes authors.
What Needs to Be Done
We should improve the logic in
hack/docs
so that it's not tied to a hardcoded controller-runtime version.We could either:
ControllerRuntimeVersion
constant in the scaffolding codeThis would prevent future breakages when we upgrade dependencies and keep
make generate-docs
stable and version-aware.The text was updated successfully, but these errors were encountered: