Skip to content

docs: add debugging tips to DEVELOPMENT.md#1646

Open
alliasgher wants to merge 1 commit intofluxcd:mainfrom
alliasgher:docs-debugging-tips
Open

docs: add debugging tips to DEVELOPMENT.md#1646
alliasgher wants to merge 1 commit intofluxcd:mainfrom
alliasgher:docs-debugging-tips

Conversation

@alliasgher
Copy link
Copy Markdown

@alliasgher alliasgher commented Apr 25, 2026

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 --concurrent-ssa=1 to serialize reconciles and SSA for a clean trace
  • flux suspend kustomization for unrelated objects sharing the cluster

Cross-controller setup with source-controller (port-forward + SOURCE_CONTROLLER_LOCALHOST) is already documented under 'How to run the controller locally' and is not duplicated here.

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

Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debugging info is already covered in "How to run the controller locally". The added text contains inaccurate info, you can not run SC locally as KC can not reach it, there is no mention of the ENV VAR, etc.

@alliasgher did you actually tested this? Did you used AI to generate this text, if so you need to disclose it, see fluxcd/flux2#5848

@alliasgher alliasgher force-pushed the docs-debugging-tips branch from 143768e to f9b8044 Compare April 26, 2026 13:53
@alliasgher
Copy link
Copy Markdown
Author

Thanks for the catch @stefanprodan, you are right on all three points. AI assistance disclosed (Assisted-by: Claude/claude-opus-4-7 is now on the commit and the PR body, per fluxcd/flux2#5848 — sorry for missing it the first time round).

Fixed in f9b8044: I removed the 'Cross-controller interactions' paragraph entirely. The cross-controller setup is already covered correctly in 'How to run the controller locally' via kubectl port-forward svc/source-controller 8080:80 + SOURCE_CONTROLLER_LOCALHOST=localhost:8080, and my paragraph was both wrong (kustomize-controller can't reach a source-controller running outside the cluster) and missed the env var.

What is left is just RUNTIME_NAMESPACE, --concurrent=1 --concurrent-ssa=1, and flux suspend kustomization, which I do not think the existing section covers. Happy to drop the section entirely if you'd rather not have it.

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 --concurrent-ssa=1 to serialize reconciles and
  server-side apply for a clean trace
- flux suspend kustomization for unrelated objects sharing the cluster

Cross-controller setup with source-controller (port-forward +
SOURCE_CONTROLLER_LOCALHOST) is already documented under 'How to run
the controller locally' so it is not duplicated here.

Assisted-by: Claude/claude-opus-4-7
Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher alliasgher force-pushed the docs-debugging-tips branch from f9b8044 to 1c47faa Compare April 26, 2026 14:35
Comment thread DEVELOPMENT.md
Comment on lines +104 to +106
The controller watches every namespace by default. To narrow it to a single
namespace, set the `RUNTIME_NAMESPACE` environment variable before invoking
`make run`:
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting RUNTIME_NAMESPACE does not restrict the watchers, it just tells the controller in which namespace it runs. Watching only the flux-system namespace would break debugging so there is no point in having this Limit the watched namespace section.

Comment thread DEVELOPMENT.md
Comment on lines +112 to +118
### Reduce reconcile concurrency

Each `Kustomization` reconcile is processed concurrently (default
`--concurrent=4`, plus an independent `--concurrent-ssa=4` for server-side
apply). When debugging it is almost always easier to follow a serial
trace; pass `--concurrent=1 --concurrent-ssa=1` so reconciles and SSA
operations run one at a time:
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you debug goroutine leaks, dead locks and other issues that only surface when concurrency is used? Also if you suspend all objects but the one you are debugging, then setting --concurrent=1 has no effect.

Comment thread DEVELOPMENT.md
interleave with yours:

```sh
flux suspend kustomization <name>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an --all flag

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.

2 participants