Skip to content

Commit db58427

Browse files
committed
docs: add debugging tips to DEVELOPMENT.md
Adds a 'Debugging the controller locally' section to DEVELOPMENT.md covering the knobs that come up most often when reproducing issues: - RUNTIME_NAMESPACE to scope the watch - --concurrent=1 to serialize reconciles for a clean trace - flux suspend for unrelated HelmReleases sharing the cluster - Cross-controller setup with source-controller for paths that depend on HelmChart/HelmRepository artifacts Mirrors the equivalent docs improvement on notification-controller (fluxcd/notification-controller#362). Fixes #462 Signed-off-by: alliasgher <alliasgher123@gmail.com>
1 parent 6976478 commit db58427

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

DEVELOPMENT.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,50 @@ Deploy `helm-controller` into the cluster that is configured in the local kubeco
9797

9898
```sh
9999
make deploy
100-
```
100+
```
101+
102+
## Debugging the controller locally
103+
104+
When reproducing an issue or stepping through reconciliation logic, the
105+
following knobs make local runs cheaper and the resulting logs easier to
106+
read.
107+
108+
### Limit the watched namespace
109+
110+
The controller watches every namespace by default. To narrow it to a single
111+
namespace, set the `RUNTIME_NAMESPACE` environment variable before invoking
112+
`make run`:
113+
114+
```sh
115+
RUNTIME_NAMESPACE=flux-system make run
116+
```
117+
118+
### Reduce reconcile concurrency
119+
120+
Each `HelmRelease` reconcile is processed concurrently (default
121+
`--concurrent=4`). When debugging it is almost always easier to follow a
122+
serial trace; pass `--concurrent=1` so reconciles run one at a time:
123+
124+
```sh
125+
go run ./main.go --concurrent=1
126+
```
127+
128+
### Suspend unrelated objects
129+
130+
If the controller is sharing a cluster with other Flux objects, suspend
131+
anything not relevant to the test you're running so their reconciles don't
132+
interleave with yours:
133+
134+
```sh
135+
flux suspend helmrelease <name>
136+
```
137+
138+
Resume with `flux resume helmrelease <name>` when you're done.
139+
140+
### Cross-controller interactions
141+
142+
`helm-controller` reads `HelmChart` and `HelmRepository` artifacts produced
143+
by `source-controller`. When testing a path that needs a fresh chart, run
144+
`source-controller` locally too (or keep its in-cluster instance running)
145+
and point both at the same management cluster. Suspending unrelated
146+
controllers' objects per the previous step avoids racing reconciles.

0 commit comments

Comments
 (0)