← Back to Pull requests

feat(cli): report leadership in ha status #16343

Closed
unknown closed this pull request without merging on Nov 26, 2026 11:46 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 22:37 UTC
Author

BRIEF Change description

<!--
Describe what this pull request does.

If your pull request is to address an open issue, indicate it by specifying the
issue number:
If your pull request fixes an issue which has not been filed, please file the
issue and put the number here.

For example: "Fixes #858"
-->
Followup of #15370 and #16194
Add a ROLE column and a Lease line to config-connector ha status, so it shows which cluster holds the multi-cluster lease.

ROLE values:
Leader : the cluster holds the lease, so its Config Connector reconciles
Standby: another cluster holds the lease
Unknown: HA is configured, but the lease holder can't be determined
-: HA isn't configured, or the cluster couldn't be read

How the role is determined:
- Every cluster configured: the leader is the holder all clusters agree on (from the existing checks). If it can't be determined, every cluster is Unknown. This happens when a lease is missing, expired or has no holder, the clusters disagree, the holder isn't in --contexts, or the election settings don't match.
- Only some clusters configured: those clusters don't share an election with the rest, so each configured cluster's role comes from its own MultiClusterLease. It is Leader if it holds a live lease, Standby if another cluster does, and Unknown if its lease isn't live (the lease problem is listed).

The Lease line is shown whenever the leader is known, including on ERROR. It gives the lease and the leader, and when the leader last renewed it.

The problem reported for a cluster without HA, when other clusters have it, now explains the risk: that cluster reconciles independently of the HA clusters, so more than one cluster may change the same resources.

Examples:

Healthy:

      CONTEXT                           PROJECT  LOCATION     HA          ROLE
      gke_proj-a_us-central1_cluster-a  proj-a   us-central1  Configured  Leader
      gke_proj-b_us-east1_cluster-b     proj-b   us-east1     Configured  Standby

      Lease: cnrm-system/kcc-multicluster-lease, held by cluster-a (renewed 4s ago)
      HA Status: HEALTHY

Only cluster-a is configured:

      CONTEXT                           PROJECT  LOCATION     HA              ROLE
      gke_proj-a_us-central1_cluster-a  proj-a   us-central1  Configured      Leader
      gke_proj-b_us-east1_cluster-b     proj-b   us-east1     Not configured  -

      Lease: cnrm-system/kcc-multicluster-lease, held by cluster-a (renewed 4s ago)
      HA Status: ERROR
      Problems:
        - cluster "gke_proj-b_us-east1_cluster-b" does not have spec.experiments.multiClusterLease configured on ConfigConnector "configconnector.core.cnrm.cloud.google.com"; run `config-connector ha setup` or configure spec.experiments.multiClusterLease; it reconciles independently of the HA clusters, so more than one cluster may change the same resources

The lease has expired, so the leader is unknown:

      CONTEXT                           PROJECT  LOCATION     HA          ROLE
      gke_proj-a_us-central1_cluster-a  proj-a   us-central1  Configured  Unknown
      gke_proj-b_us-east1_cluster-b     proj-b   us-east1     Configured  Unknown

      HA Status: ERROR
      Problems:
        - cluster "gke_proj-a_us-central1_cluster-a": the lease held by "projects/proj-a/locations/us-central1/clusters/cluster-a" has expired (last renewed at 2026-11-10T18:05:00Z, lease duration 15s)
        - cluster "gke_proj-b_us-east1_cluster-b": the lease held by "projects/proj-a/locations/us-central1/clusters/cluster-a" has expired (last renewed at 2026-11-10T18:05:00Z, lease duration 15s)

WHY do we need this change?

Special notes for your reviewer:

Does this PR add something which needs to be 'release noted'?


<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->
``release-note
None

- [ ] Reviewer reviewed release note.

#### Additional documentation e.g., references, usage docs, etc.:

<!--
This section can be blank if this pull request does not require any additional documentation.

When adding links which point to resources within git repositories, like
usage documentation, please reference a specific commit and avoid
linking directly to the master branch. This ensures that links reference a
specific point in time, rather than a document that may change over time.

See here for guidance on getting permanent links to files: https://help.github.com/en/articles/getting-permanent-links-to-files

Please use the following format for linking documentation:
- [Usage]: <link>
- [Other doc]: <link>
-->
docs

`

Intended Milestone

Please indicate the intended milestone.

  • Reviewer tagged PR with the actual milestone.
  • Tests you have done

    <!--

    Make sure you have run "make ready-pr" to run required tests and ensure this PR is ready to review.

    Also if possible, share a bit more on the tests you have done.

    For example if you have updated the pubsubtopic sample, you can share the test logs from running the test case locally.

    go test -v -tags=integration ./config/tests/samples/create -test.run TestAll -run-tests pubsubtopic

    -->

  • Run make ready-pr` to ensure this PR is ready for review.

  • Perform necessary E2E testing for changed resources.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: acpana Review duration: 3669m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16343"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%