← Back to Pull requests

refactor: unify cluster-managed-resource labels #582

Merged
silentred merged 11 files (104 lines) on Dec 02, 2026 18:41 UTC
View on GitHub
silentred silentred commented on Nov 30, 2026 08:32 UTC
Author

The two functions etcdClusterLabels and clusterNameLabels are functionally identical. For simplicity, I unified the labels to clusterNameLabels.

/cc @ahrtr @nwnt

Diff: 104 lines (+46 / -58) across 11 files Reviewer: nwnt Review duration: 3488m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.46) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 104 lines diff across 11 files
0.46
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.89 · 5 substantive comment(s)
0.89
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
90%
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.278
Real PR Conversation Timeline
8 items
nwnt nwnt approved these changes on Dec 01, 2026 03:03 UTC
Approved Reviewer

Nit: occurrences like operator.etcd.io/cluster="+etcdClusterName in test/e2e can be consolidated further, but not a blocker for me.

silentred silentred commented on Dec 01, 2026 03:52 UTC
Author

Nit: occurrences like operator.etcd.io/cluster="+etcdClusterName in test/e2e can be consolidated further, but not a blocker for me.

Updated. The literals are replaced by controller.ClusterNameLabel in e2e tests.

silentred silentred commented on Dec 02, 2026 13:12 UTC
Author

@ahrtr PTAL, thanks.

ahrtr ahrtr commented on code on Dec 02, 2026 15:16 UTC
Code Review
internal/controller/utils.go:1
@@ -49,24 +49,15 @@ func pvcNameForMember(podName string) string {
 	return fmt.Sprintf("%s-%s", volumeName, podName)
 }
 
-// etcdClusterLabels returns the label set applied to every member pod and used
-// by the headless Service selector.
-func etcdClusterLabels(ec *ecv1alpha1.EtcdCluster) map[string]string {
-	return map[string]string{
-		"app":        ec.Name,
-		"controller": ec.Name,
-	}
-}
-
-// clusterNameLabel marks cluster-owned objects with their EtcdCluster's name,
+// ClusterNameLabel marks cluster-owned objects with their EtcdCluster's name,
 // letting owned objects be selected by label.
-const clusterNameLabel = "operator.etcd.io/cluster"
+const ClusterNameLabel = "operator.etcd.io/cluster"
 
 // clusterNameLabels returns the label set that marks objects (EtcdMembers,
-// PVCs) with the name of the cluster they belong to, letting them be
-// selected by label.
+// member Pods, PVCs, the headless Service) with the name of the cluster they

let's also add the Secrets created by AutoProvider?

ahrtr ahrtr approved these changes on Dec 02, 2026 15:16 UTC
Approved Reviewer

LGTM with a minor comment. thx

kubernetes-prow[bot] kubernetes-prow[bot] commented on Dec 02, 2026 15:16 UTC
Bot

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: <a href="https://github.com/etcd-io/etcd-operator/pull/582#pullrequestreview-6153653211" title="Approved">ahrtr</a>, <a href="https://github.com/etcd-io/etcd-operator/pull/582#pullrequestreview-6124414267" title="Approved">nwnt</a>, <a href="https://github.com/etcd-io/etcd-operator/pull/582#" title="Author self-approved">silentred</a>

The full list of commands accepted by this bot can be found here.

The pull request process is described here

<details >
Needs approval from an approver in each of these files:

  • ~~OWNERS~~ [ahrtr,silentred]
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":[]} -->

    silentred silentred commented on code on Dec 02, 2026 15:46 UTC
    Code Review
    internal/controller/utils.go:1
    @@ -49,24 +49,15 @@ func pvcNameForMember(podName string) string {
     	return fmt.Sprintf("%s-%s", volumeName, podName)
     }
     
    -// etcdClusterLabels returns the label set applied to every member pod and used
    -// by the headless Service selector.
    -func etcdClusterLabels(ec *ecv1alpha1.EtcdCluster) map[string]string {
    -	return map[string]string{
    -		"app":        ec.Name,
    -		"controller": ec.Name,
    -	}
    -}
    -
    -// clusterNameLabel marks cluster-owned objects with their EtcdCluster's name,
    +// ClusterNameLabel marks cluster-owned objects with their EtcdCluster's name,
     // letting owned objects be selected by label.
    -const clusterNameLabel = "operator.etcd.io/cluster"
    +const ClusterNameLabel = "operator.etcd.io/cluster"
     
     // clusterNameLabels returns the label set that marks objects (EtcdMembers,
    -// PVCs) with the name of the cluster they belong to, letting them be
    -// selected by label.
    +// member Pods, PVCs, the headless Service) with the name of the cluster they

    Updated. Also added a TODO comment to the Secret, which does not have Labels and OwnerReferences for now.

    Reviewers
    Assignees
    silentred silentred
    Labels
    risk: low confidence: 90.8% 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: 45.5% (MEDIUM) · Higher = larger blast radius
    45.5%
    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: 90.8% · Lower = rushed or shallow review
    90.8%
    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: 4.2% · Safe to merge
    4.2%