Skip to content

Commit 17f7fc6

Browse files
committed
docs: add debugging tips to DEVELOPMENT.md
Expand the local development guide with concrete tips for debugging controller issues, as requested in #666: - RUNTIME_NAMESPACE env var to limit watched namespaces - --concurrent=1 flag to serialise reconcile loops - HOSTNAME env var for leader election identity - How to suspend irrelevant Flux objects to reduce log noise - How to scale down the in-cluster deployment to avoid conflicts Signed-off-by: Ali <alliasgher123@gmail.com> Assisted-by: Claude/claude-opus-4-7
1 parent 679a0f8 commit 17f7fc6

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

DEVELOPMENT.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,62 @@ Run the controller locally:
5454
make run
5555
```
5656

57+
### Debugging tips
58+
59+
**Limit watched namespaces**
60+
61+
Set `RUNTIME_NAMESPACE` to restrict the controller to a single namespace,
62+
which reduces noise when debugging a specific issue:
63+
64+
```sh
65+
export RUNTIME_NAMESPACE=flux-system
66+
make run
67+
```
68+
69+
**Decrease concurrency**
70+
71+
Lower `--concurrent` to `1` so that reconcile loops run sequentially,
72+
making it easier to follow logs and reproduce ordering issues:
73+
74+
```sh
75+
make run ARGS="--concurrent=1"
76+
```
77+
78+
**Set the controller hostname**
79+
80+
The controller uses the `HOSTNAME` environment variable as its identity
81+
for leader election. When running locally, set it to match the
82+
in-cluster deployment name to avoid lease conflicts:
83+
84+
```sh
85+
export HOSTNAME=source-controller
86+
make run
87+
```
88+
89+
**Suspend irrelevant objects**
90+
91+
Suspend Flux objects that are unrelated to the issue you are
92+
investigating so that their reconciliation does not add log noise:
93+
94+
```sh
95+
kubectl -n flux-system patch gitrepository <name> \
96+
--type=merge -p '{"spec":{"suspend":true}}'
97+
```
98+
99+
Replace `gitrepository` with `helmrepository`, `ocirepository`, or
100+
`bucket` as appropriate.
101+
102+
**Scale down the in-cluster controller**
103+
104+
If `source-controller` is already running in your cluster, scale it
105+
down before running locally to avoid competing reconciliations:
106+
107+
```sh
108+
kubectl -n flux-system scale deployment/source-controller --replicas=0
109+
# restore when done:
110+
kubectl -n flux-system scale deployment/source-controller --replicas=1
111+
```
112+
57113
## How to install the controller
58114

59115
### Building the container image

0 commit comments

Comments
 (0)