@@ -91,4 +91,53 @@ Deploy `kustomize-controller` into the cluster that is configured in the local k
9191make 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.
135+
136+ ### Cross-controller interactions
137+
138+ ` kustomize-controller ` consumes artifacts produced by ` source-controller `
139+ (` GitRepository ` , ` OCIRepository ` , ` Bucket ` ). When testing a path that
140+ needs a fresh artifact, run ` source-controller ` locally too (or keep its
141+ in-cluster instance running) and point both at the same management
142+ cluster. Suspending unrelated controllers' objects per the previous step
143+ avoids racing reconciles.
0 commit comments