villebro opened a new pull request, #131:
URL: https://github.com/apache/superset-kubernetes-operator/pull/131

   ## Summary
   
   The operator's controller logging worked but was uneven: it used only Info 
(V0) and a handful of V(1) lines, with no V(2) trace level and no documented 
policy for which level a given message belongs at. When an operator needed to 
debug a stuck reconcile, there were no granular breadcrumbs to turn on — 
several reconcile paths (HPA/PDB scaling, NetworkPolicy, config rendering, 
version comparison, the main loop phases) logged nothing at all.
   
   This PR defines a three-tier logging policy aligned with controller-runtime 
best practices, documents it in the developer guidelines, and implements it 
with a targeted set of high-value log statements. Operators can now raise 
verbosity with `--zap-log-level=debug` (V1) or `=2` (V2) to get progressively 
more detail without any noise at the default level. There are no API or 
behavior changes.
   
   ## Details
   
   **Policy** (documented in `docs/contributing/development-guidelines.md`, 
with a brief user-facing pointer in `docs/user-guide/installation.md`):
   
   - **Info / V(0)** — meaningful state *transitions* only; must not fire on 
every reconcile.
   - **V(1) / debug** — per-reconcile progress and decisions (reconcile entry, 
phase markers, requeue scheduling, CRD-absent skips).
   - **V(2) / trace** — fine-grained internals (config size/checksum, version 
comparison, per-resource CreateOrUpdate ops even when unchanged).
   - **Error** — reserved for *swallowed* non-fatal errors only; never 
double-log an error that's also returned (controller-runtime logs it and an 
Event is recorded).
   - Cross-cutting rules: every-reconcile lines are V(1)+; camelCase structured 
keys; never log secret values or rendered config bodies (log 
sizes/counts/checksums); pure packages stay log-free.
   
   **Implementation** (`internal/controller/`):
   
   - `status.go`: corrected the one level mismatch — a swallowed 
Deployment-read error moved from `Info` to `Error`.
   - `superset_controller.go`: V(1) phase markers (lifecycle incomplete, 
maintenance active, schedule requeue) and a V(2) config checksum.
   - `component_descriptors.go`: V(2) rendered-config breadcrumb (size/count 
only, never content) and workload checksum.
   - `component_reconciler.go`: V(2) "Component unchanged" symmetric to the 
existing V(0) "Reconciled component".
   - `scaling.go` / `networkpolicy.go`: V(2) HPA/PDB/NetworkPolicy reconcile 
ops.
   - `lifecycle.go`: V(2) version-comparison result at the call site (pure 
`version.go` left untouched).
   
   The pre-existing lifecycle transition logs (Info/V0) were intentionally kept 
as transitions, not regressed to V(1).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to