feat: label the CRD with its managing installation and guard duplicat… #440
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.49) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.49 · 320 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #440"
general
weight: 0.35
ajaysundark
Summary
Stamps the
NodeReadinessRuleCRD with amanaged-bylabel naming the installation that owns it, and refuses a freshhelm installwhen the CRD already exists.Design notes
Why the CRD carries the label. It's cluster scoped and singleton, so it's the one artifact every install flow contends over. It's set with a controller-gen marker, so
make manifestsregenerates it inconfig/crd/bases, andverify-chart-drift.shdiffs that against the chart'scrds/copy to catch the two drifting apart.Why a template guard, not a pre-install hook. The Helm guard uses
lookup+failin a template — same outcome without a ServiceAccount, ClusterRole or image, and it aborts at render time so the guidance lands in the terminal rather than Job logs.Why it's keyed on
.Release.IsInstallplus CRD existence, not the label value. Both installs may be carrying the default value, and that's precisely the accident being guarded against, so a value comparison would pass straight through it. Upgrades skip the check naturally.Two things worth a reviewer's attention
Label is CRD-only. Helm 3 forces
managed-by: Helmon resources it owns, so stamping the Deployment/RBAC/Services doesn't stick. The CRD works because Helm neither templates nor trackscrds/.Guard only covers
helm install.kubectl apply, kustomize and the static-pod path have none. A controller startup check would close the gap, but it's ruled out by alternative (1) in the issue — left out and documented. Happy to reconsider.Also included
Chart-rendered
NodeReadinessRuleCRs now get the standard chart labels, which they were missing. Unrelated tidy-up, happy to split it out.Related Issue
Fixes #438
Type of Change
/kind feature
Testing
helm installinto a clean cluster: CRD is created with app.kubernetes.io/managed-by=node-readiness-controller.helm installwith a second release name while the CRD exists: render aborts with the guidance message, nothing is applied.helm upgradeon the existing release: check is skipped, upgrade succeeds.helm templateoutput diffed againstdist/crds.yaml;verify-chart-drift.shpasses.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?
Yes
``
release-note
helm installnow fails when aNodeReadinessRuleCRD from another installation is already present in the cluster. The CRD carries amanaged-bylabel identifying the owning installation.
``