Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
camilamacedo86 opened this issue Mar 26, 2025 · 5 comments · Fixed by #4713
Closed
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Comments

@camilamacedo86
Copy link
Member

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.

@camilamacedo86 camilamacedo86 added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Mar 26, 2025
@sbin64
Copy link

sbin64 commented Mar 26, 2025

/assign

@sbin64
Copy link

sbin64 commented Mar 26, 2025

Taking this up. @camilamacedo86

@p-shah256
Copy link
Contributor

Hi @camilamacedo86 ! 👋

I've submitted a PR with a fix for the hardcoded controller-runtime version issue. The solution imports the ControllerRuntimeVersion constant from the scaffolding package to ensure both places use the same source of truth.

Let me know if this approach works for you or if you'd prefer another solution! 🚀

@sbin64
Copy link

sbin64 commented Mar 29, 2025

Thanks for the PR @p-shah256. FYI, this is not a good practice when somebody has already taken up and has not been asked if he is working.

@p-shah256
Copy link
Contributor

p-shah256 commented Mar 29, 2025

Hey @sbin64 - I'm sorry about that! I didn't mean to step on your toes here.
I saw the issue had been open for a bit, so I just submitted one option for how to tackle this.

I'm totally happy to close my PR if you're already working on a solution, or we could collaborate if you think the approach is helpful. Just let me know what works best for you. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Projects
None yet
3 participants