← Back to Pull requests

ha setup: check leader endpoints before mutating and wait until HA is healthy #16346

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

Description

This change enhances config-connector ha setup with preflight endpoint verification and post-apply health waiting:

1. Preflight Leader Endpoint Verification (Part 1):
- Before mutating GCP resources or cluster configurations, executeSetup describes each GKE cluster via gcloud container clusters describe --format=json.
- Adds a read-only output method to commandRunner that runs in --dry-run and suppresses command printing.
- Validates that every cluster exposes the leader endpoint required by other clusters (Default, DNS, or PrivateIP), skipping clusters where replication is disabled.
- Fails with actionable remediation commands (errors.Join) if any cluster does not expose the required endpoint.
- Warns on stderr (deduplicated) when cross-region network topology without global access, differing VPC networks, or authorized networks might block connections.
- Prints a one-line summary reporting which endpoint types were verified across clusters.

2. Wait Until HA is Healthy (Part 2):
- Adds --wait (default true) and --wait-timeout (default 5m) flags to ha setup, rejecting non-positive timeout values.
- Sets cmd.SilenceUsage = true after flag validation.
- After applying cluster configurations, polls every 5s reusing executeStatus until multi-cluster HA status is healthy (haStateHealthy).
- On success, prints a summary reporting the elected leader, standbys, and replication mode.
- On timeout, returns an error listing the last poll problems, confirming that configuration was applied and not rolled back, providing the ha status command to inspect, and adding a namespaced-mode restart note when applicable.
- Supports skipping wait via --wait=false (printing the ha status command), --dry-run (printing a [dry-run] wait notice), and --yaml-only.

Fixes #16339

``release-note
(Alpha)
config-connector ha setup checks that every cluster exposes the selected leader endpoint before it changes anything. After the changes, it waits until the clusters agree on a leader and the standbys sync, and then prints a summary. Use --wait=false to skip the wait.
``

This pull request was generated by an AI coding agent.

<sub>🤖 Agent session</sub>

<!-- factory:task-output kind=Change task=recipe-fix-20261123-223730-ccdf -->

Diff: 309 lines (+231 / -78) across 3 files Reviewer: acpana Review duration: 2748m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 309 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%
56%
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.343
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #16346"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.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: 40.2% (MEDIUM) · Higher = larger blast radius
40.2%
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: 56.8% · Lower = rushed or shallow review
56.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: 17.4% · Safe to merge
17.4%