📖 (docs): Show webhook configuration in cronjob tutorial #5257
Conversation
|
Hi @BadisLaffet1. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BadisLaffet1, camilamacedo86, vitorfloriano The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
📖 (docs): Show webhook configuration in cronjob tutorial
Fixes #5238
Problem
The webhook setup code in
cmd/main.gowas hidden in the cronjob tutorial'smain-revisitedpage.Root Cause
The cronjob tutorial generator was adding a collapse marker at the end of
cmd/main.go(lines 371-380), which collapsed everything after the controller setup, including the webhook configuration that users needed to see.Discovery: Multiversion Dependency
Found that multiversion tutorial has interdependent code:
Line 79 in
generate_multiversion.go:The multiversion tutorial copies files from cronjob, then has logic expecting certain markers to exist. This dependency required changes to both files.
Changes Made
File 1:
hack/docs/internal/cronjob-tutorial/generate_cronjob.goFunction:
updateMain()Lines deleted: 371-380
Code removed:
Why: This code was inserting a collapse marker at the end of
main.go:// +kubebuilder:docs-gen:collapse=Remaining code from main.goThis marker collapsed everything from controller setup to the end of file, hiding the webhook configuration (issue 5238).
File 2:
hack/docs/internal/multiversion-tutorial/generate_multiversion.goFunction:
updateMain()Lines deleted: 686-703 (two blocks)
Block 1 (lines 686-694)
Code removed:
What it did: Added the same collapse marker in multiversion's
main.goBlock 2 (lines 696-703)
Code removed:
What it did: Searched for and removed duplicate collapse markers (two consecutive identical markers)
Why Both Multiversion Blocks Were Removed
The problem: Block 2 expected to find duplicate markers (one from cronjob, one from Block 1). After removing the cronjob marker, this pattern no longer exists, causing build error:
"unable to find the content to be replaced"Three options considered:
Result
The webhook configuration is now visible in main-revisited page :
Multiversion tutorial remains unchanged