← Back to Pull requests

OCPBUGS-126492: aws: fix destroy hang when custom service endpoints target a different region #11034

Open
unknown opened this pull request with 310 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 28, 2026 08:30 UTC
Author

Summary

When openshift-install destroy cluster runs on a cluster with custom service endpoints (e.g., for a private VPC endpoint), the destroy process can hang indefinitely if the install region differs from the partition's global region (which it almost always does).

Root Cause

The installer creates secondary tagging clients for global regions (e.g., us-east-1 for Route53 hosted zone lookups). These clients were receiving the user's custom ServiceEndpoint list, which is specific to the install region. Since ServiceEndpoint has no region dimension, the endpoint resolver would set the URL to the install-region endpoint while the SigV4 signing region was set to the global region, causing an authentication failure.

The persistent auth error caused FindTaggedResourcesToDelete to retain the failing tag client on every poll iteration, keeping loopError non-nil and preventing the wait.PollImmediateUntil condition from ever being satisfied. Since Run() uses context.Background() (no deadline), the destroy process looped forever.

Fix

Adds an endpointsForRegion() helper method that returns custom endpoints only when the target region matches the install region. For cross-region tagging clients, nil endpoints are passed, so the AWS SDK resolves the default endpoint for that region.

This ensures:

  • The base tagging client for the install region continues to use custom endpoints ✅

  • Secondary clients for global regions (us-east-1, cn-northwest-1, us-gov-west-1) use default AWS endpoints when the install region differs ✅

  • No SigV4 signing-region / URL mismatch ✅
  • Testing

  • Added unit tests for endpointsForRegion() covering all region match/mismatch scenarios

  • go vet and gofmt pass clean
  • /jira refresh

    Related: OCPBUGS-86052

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    AWS cluster removal now selects configured service endpoints based on the requested region. In the installation region, configured endpoints remain unchanged; in other regions, tagging endpoints are excluded while other endpoints, including STS where available, are preserved.
    * This selection applies to assumed-role and cross-region tagging requests. Other AWS requests continue to use all configured endpoints.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 310 lines (+232 / -78) across 3 files Reviewer: sadasu Review duration: 48097m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 310 lines diff across 3 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.343
    Real PR Conversation Timeline
    1 comments
    "Review active on #11034"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% 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: 47.3% (MEDIUM) · Higher = larger blast radius
    47.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: 44.7% · Lower = rushed or shallow review
    44.7%
    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: 26.1% · Safe to merge
    26.1%