fix(controller): check the kube config error before using the config #3333
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.63) × (1 − Review Confidence (0.58)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 280 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.337
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #3333"
general
weight: 0.35
nabuskey
Purpose of this PR
controller startpanics with a nil pointer dereference when no kube config can be loaded, instead of logging the error and exiting.start()setscfg.WarningHandlerbefore it checks the error returned byctrl.GetConfig(), and the config is nil when that call fails.Proposed changes:
ctrl.GetConfig()beforecfg.WarningHandleris set, ascmd/operator/webhook/start.goalready does.Change Category
Rationale
Running
controller startwith no kubeconfig and outside a cluster, before this change:After this change the process logs the cause and exits with status 1:
Checklist
Additional Notes
start()ends inos.Exit. I checked the change by running the binary before and after it; the output is above.go build ./cmd/operatorandgo vet ./cmd/operator/...pass. I did not runmake unit-testormake go-lintlocally (Windows), so the last box is left unticked.WarningHandler,GetConfigand "failed to get kube config", and read the open PRs that touchcmd/operator/controller/start.go(#3290 and my own #3329). None of them changes these lines.