← Back to Pull requests

NO-JIRA: fix: align controller logging with controller-runtime guidelines #49

Closed
unknown closed this pull request without merging on Oct 07, 2026 10:13 UTC
View on GitHub
unknown unknown commented on Oct 05, 2026 10:46 UTC
Author

Reduce default-level noise and log real state changes instead of every reconcile. Followup from #43 .

To be honest, this is a bit difficult as there does not seem to exist a definitive guide but I after going back and forth on this with AI I think the proposed state is an improvement even if some parts might be subjective.

We don't have to follow the guidelines from controller-runtime or kubernetes but the referenced sections/reasons make sense IMO.

Summary

Used guidelines: controller-runtime TMP-LOGGING.md (idk why itis prefixed with tmp..., it's quite old) and Kubernetes sig-instrumentation logging.md.

  • Drop the "Reconciling" entry lines. controller-runtime already traces reconciles at V(5) and the context logger carries the controller, object and reconcileID.

  • Log expected conditions at V(1) instead of Info: object or HCP not found, waiting for version, CSR already processed, upgrade in progress, user data secret missing. Use V(1) for the former V(4) tag filter log (controller-runtime recommends only V(0) and V(1)).

  • Use a constant message with an "err" key instead of log.Info(err.Error()), so messages can be searched and counted (controller-runtime "Logging messages": no variable content in messages).

  • Log "Created X" from the CreateOrUpdate result for CRDs, default NodeClass, EC2NodeClass and the subnets ConfigMap, and "Updated X" where the mutation is idempotent (default NodeClass, ConfigMap). Updates of CRDs and EC2NodeClass are not logged because API server defaulting makes CreateOrUpdate report an update on every reconcile.

  • - This changes again when SSA is used.
  • Log "Approved CSR" after the approval succeeded instead of "Attempting" before it. Log the subnets ConfigMap deletion only when it existed; it was logged on every reconcile.

  • - Was a useful suggestion by AI, decided to keep it
  • Log the EC2 status update at V(1), only when a patch is issued.

  • Remove the "failed to" prefix from wrapped errors (Kubernetes guidance: repetitive when wrapped multiple times) and capitalise setup log messages (Kubernetes message style guidelines).

  • Obtain the logger via ctrl.LoggerFrom(ctx) consistently.

  • Use space separated keys in structured logs
  • Diff: 288 lines (+216 / -72) across 3 files Reviewer: maxcao13 Review duration: 2846m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 288 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.339
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #49"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.8% (MEDIUM) · Higher = larger blast radius
    39.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.7% · Safe to merge
    15.7%