Skip to content

Improve hack/docs to avoid failures when upgrading controller-runtime version #4679

Closed
@camilamacedo86

Description

@camilamacedo86

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 triggers make 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:

`// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile`, skipGoCycloLint)

This causes make generate-docs to fail when we bump the controller-runtime version in the scaffold logic. For example, updating this constant:

ControllerRuntimeVersion = "v0.20.3"

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:

  • Remove the need for the manual replacement in the first place
  • OR dynamically use the version from the ControllerRuntimeVersion constant in the scaffolding code

This would prevent future breakages when we upgrade dependencies and keep make generate-docs stable and version-aware.

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions