Skip to content

docs: add debugging tips to DEVELOPMENT.md - #1300

Closed
alliasgher wants to merge 1 commit into
fluxcd:mainfrom
alliasgher:docs-debugging-tips
Closed

docs: add debugging tips to DEVELOPMENT.md#1300
alliasgher wants to merge 1 commit into
fluxcd:mainfrom
alliasgher:docs-debugging-tips

Conversation

@alliasgher

@alliasgher alliasgher commented Apr 25, 2026

Copy link
Copy Markdown

Summary

Adds a 'Debugging the controller locally' section to DEVELOPMENT.md covering knobs not already in 'How to run the controller locally':

  • RUNTIME_NAMESPACE to scope the watch
  • --concurrent=1 to serialize reconciles for a clean trace
  • flux suspend for unrelated objects sharing the cluster

Cross-controller setup is already documented (or n/a for this controller) and is not duplicated here.

Assisted-by: Claude/claude-opus-4-7

Adds a 'Debugging the controller locally' section covering knobs that
are not already in 'How to run the controller locally':

- RUNTIME_NAMESPACE to scope the watch
- --concurrent=1 to serialize reconciles for a clean trace
- flux suspend for unrelated objects sharing the cluster

Assisted-by: Claude/claude-opus-4-7
Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher
alliasgher force-pushed the docs-debugging-tips branch from b937a0c to 7d25703 Compare April 26, 2026 14:35
@alliasgher

Copy link
Copy Markdown
Author

Self-correcting this before it wastes a reviewer's time: two of the tips in this PR are wrong, and I only found out because @stefanprodan reviewed the same text on the kustomize-controller version (fluxcd/kustomize-controller#1646).

The RUNTIME_NAMESPACE tip does not work. That variable is only read when --watch-all-namespaces is false:

if !watchOptions.AllNamespaces {
    watchNamespace = os.Getenv("RUNTIME_NAMESPACE")
}

and the flag defaults to true (fluxcd/pkg/runtime/controller/watch.go), so RUNTIME_NAMESPACE=flux-system make run on its own changes nothing. I verified this controller has the identical code. Stefan also made the broader point that narrowing the watch would hide cross-namespace behaviour you often need while debugging, so the section should go rather than be corrected.

The --concurrent=1 tip is backwards as general debugging advice: goroutine leaks, deadlocks and races only surface under concurrency, and it is redundant anyway once unrelated objects are suspended.

That is most of the substance, so I do not think there is a useful PR left here. Happy to close it, or to cut it down to just the accurate remainder if a maintainer thinks that is worth keeping. Sorry for the noise, and for sending the same wrong text to several repos at once.

@alliasgher

Copy link
Copy Markdown
Author

Closing this. Two of the three tips were wrong rather than merely imprecise, and once they are removed there is not enough left to justify a review cycle.

For the record, so this is searchable if anyone tries the same thing later:

  • Limit the watched namespace was wrong. RUNTIME_NAMESPACE is only read when --watch-all-namespaces is false, and that flag defaults to true, so the documented command had no effect. @stefanprodan also made the stronger point that narrowing the watch would hide cross-namespace behaviour you often need while debugging, so the section should not exist even in a corrected form.
  • Reduce reconcile concurrency was backwards as general advice: goroutine leaks, deadlocks and races only surface under concurrency, and it is redundant once unrelated objects are suspended.
  • Suspend unrelated objects was the only sound tip, and it amounts to mentioning that flux suspend <kind> --all exists, which is not worth a PR on its own.

Thanks @stefanprodan for the review that caught this, and apologies to the other repos for receiving the same wrong text. If a maintainer does want a debugging section in DEVELOPMENT.md, I am happy to write one from scratch against what the flags actually do.

@alliasgher alliasgher closed this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant