← Back to Pull requests

ha: support GKE Fleet Connect Gateway kubeconfig contexts in ha setup and ha status #16593

Closed
unknown closed this pull request without merging on Nov 30, 2026 08:55 UTC
View on GitHub
unknown unknown commented on Nov 28, 2026 05:37 UTC
Author

This pull request was generated by an AI coding agent.

Summary

Support GKE Fleet Connect Gateway kubeconfig contexts in config-connector ha setup and config-connector ha status.

Key Changes

  • resolveGKECluster helper (pkg/cli/cmd/ha/gke_context.go):

  • - Fast path (zero API calls): Direct parsing of gke_<project>_<location>_<cluster> from context name, with a fallback to the underlying kubeconfig context.cluster name to support kubectl config rename-context aliases.
    - Connect Gateway path: Detects Connect Gateway endpoint URLs matching https://([a-z0-9-]+-)?connectgateway\.googleapis\.com/v[^/]+/projects/([^/]+)/locations/([^/]+)/gkeMemberships/([^/]+) on the REST client config Host (or kubeconfig server URL). Queries gcloud container fleet memberships describe <membership> --location=<memLoc> --project=<fleetProj> --format=json via runner.output to extract the authoritative endpoint.gkeCluster.resourceLink.
    - Validation & normalization: Rejects non-GKE / attached Fleet clusters with a clear error indicating that multi-cluster HA requires GKE clusters. If <proj> in resourceLink is a numeric project number, resolves it to the GCP project ID via gcloud projects describe <proj> --format='value(projectId)' so GSA emails, Workload Identity bindings, and gkeCluster remain consistent.
  • ha status (pkg/cli/cmd/ha/status.go):

  • - Removed the upfront parseGKEContext loop in statusOptions.validate(), keeping runtime errors after cmd.SilenceUsage = true so Cobra usage text is not dumped on context resolution failures.
    - In inspectCluster, prefers ConfigConnector.spec.experiments.multiClusterLease.gkeCluster when the cluster is reachable and configured (zero extra gcloud calls).
    - Falls back to resolveGKECluster when a cluster is unreachable or unconfigured so PROJECT, LOCATION, and clusterIdentity() remain accurate, avoiding false "leader outside --contexts" errors when a Connect Gateway cluster is down.
  • ha setup (pkg/cli/cmd/ha/cluster_configurer.go, setup.go):

  • - Passes commandRunner into newClusterConfigurer and uses resolveGKECluster to resolve cluster coordinates. Read-only describe commands run via runner.output without mutations in --dry-run and --yaml-only.
  • Unit Tests:

  • - Added tests in gke_context_test.go covering fast paths, regional/global Connect Gateway URLs, numeric project normalization, cross-project Fleet hosts, and non-GKE cluster rejection.
    - Added tests in setup_test.go verifying setup over Connect Gateway (including --dry-run and --yaml-only).
    - Added tests in status_test.go verifying zero-gcloud status checks on healthy clusters, fallback resolution on unreachable clusters, and cmd.SilenceUsage behavior.

    Fixes #16592

    ``release-note
    NONE
    ``

    <sub>🤖 Agent session</sub>

    <!-- factory:task-output kind=Change task=recipe-fix-20261128-050751-3311 -->

    Diff: 389 lines (+291 / -98) across 4 files Reviewer: acpana Review duration: 3078m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.66) × (1 − Review Confidence (0.54)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 389 lines diff across 4 files
    0.66
    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%
    54%
    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.357
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #16593"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 54.2% reviewed sensitive_module
    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: 66.3% (HIGH) · Higher = larger blast radius
    66.3%
    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: 54.2% · Lower = rushed or shallow review
    54.2%
    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: 30.3% · Safe to merge
    30.3%