Skip to content

Commit 1c47faa

Browse files
committed
docs: add debugging tips to DEVELOPMENT.md
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>
1 parent 1189a81 commit 1c47faa

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

DEVELOPMENT.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,44 @@ Deploy `kustomize-controller` into the cluster that is configured in the local k
9191
make deploy
9292
```
9393

94-
Running the above will also deploy `source-controller` and its CRDs to the cluster.
94+
Running the above will also deploy `source-controller` and its CRDs to the cluster.
95+
96+
## Debugging the controller locally
97+
98+
When reproducing an issue or stepping through reconciliation logic, the
99+
following knobs make local runs cheaper and the resulting logs easier to
100+
read.
101+
102+
### Limit the watched namespace
103+
104+
The controller watches every namespace by default. To narrow it to a single
105+
namespace, set the `RUNTIME_NAMESPACE` environment variable before invoking
106+
`make run`:
107+
108+
```sh
109+
RUNTIME_NAMESPACE=flux-system make run
110+
```
111+
112+
### Reduce reconcile concurrency
113+
114+
Each `Kustomization` reconcile is processed concurrently (default
115+
`--concurrent=4`, plus an independent `--concurrent-ssa=4` for server-side
116+
apply). When debugging it is almost always easier to follow a serial
117+
trace; pass `--concurrent=1 --concurrent-ssa=1` so reconciles and SSA
118+
operations run one at a time:
119+
120+
```sh
121+
go run ./main.go --concurrent=1 --concurrent-ssa=1
122+
```
123+
124+
### Suspend unrelated objects
125+
126+
If the controller is sharing a cluster with other Flux objects, suspend
127+
anything not relevant to the test you're running so their reconciles don't
128+
interleave with yours:
129+
130+
```sh
131+
flux suspend kustomization <name>
132+
```
133+
134+
Resume with `flux resume kustomization <name>` when you're done.

0 commit comments

Comments
 (0)