← Back to Pull requests

fix(kube-applier): add v1beta2-first CAPI adapter (ARO-30416) #8313

Open
unknown opened this pull request with 311 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 29, 2026 15:50 UTC
Author

ARO-30416

What

Add a kube-applier adapter that lists Cluster API resources through the management cluster’s Kubernetes API. It prefers v1beta2 and falls back to v1beta1 only when the preferred endpoint is unserved. It returns the client used for the list so callers can update finalizers through the same API version.

Why


Related to PR #7762, which introduces NamespaceDeletion. This PR adds the standalone CAPI adapter that #7762 can use for v1beta2-first cleanup.
NamespaceDeletion is the recovery path for stuck or orphaned hosted-cluster namespaces when normal HyperShift cleanup cannot finish. On management clusters that store CAPI resources as v1beta2, writes through the deprecated v1beta1 endpoint require the HyperShift conversion webhook. If the webhook is unavailable, finalizer updates can stall cleanup. Using the storage version removes that conversion dependency for those updates.

Testing

  • Unit tests cover v1beta2 preference, v1beta1 fallback, same-version updates, pagination, and error propagation without fallback.

  • go test ./kube-applier/... and go build ./kube-applier/... passed locally.

  • Integration and E2E validation apply once the NamespaceDeletion controller calls the adapter.
  • Special notes for your reviewer

    This PR adds the adapter as a standalone change. The NamespaceDeletion cleanup path in PR #7762 needs to call the adapter and use the returned client for finalizer updates.

    PR Checklist

  • Understand Code Review Process managed by OpenShift CI bot

  • PR is scoped to a single task (no mixed concerns)

  • Title follows Conventional Commits format

  • Summary explains the "Why" behind the change

  • Linked to relevant ticket/issue

  • Screenshots included (if dashboards or other UI changes)

  • Self-reviewed the diff

  • CI/CD checks are passing (ignore Tide)

  • Draft PR used for WIP (if applicable)

  • Commit history is clean (rebased/squashed)

  • Tricky code blocks are commented

  • Specific reviewers tagged via /assign command

  • All comment threads resolved before merge
  • Diff: 311 lines (+233 / -78) across 3 files Reviewer: machi1990 Review duration: 2257m
    All Vouch review confidence checks passed
    Residual risk 0.35 = Change Risk (0.63) × (1 − Review Confidence (0.44)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 311 lines diff across 3 files
    0.63
    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
    Diff Size diff_size
    0.344
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #8313"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 44.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: 63.5% (MEDIUM) · Higher = larger blast radius
    63.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: 44.2% · Lower = rushed or shallow review
    44.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: 35.4% · Moderate risk
    35.4%
    Repository