← Back to Pull requests

feat: add parent-side MI pool allocator and env-var consumer for ARO-26725 #6635

Open
unknown opened this pull request with 568 lines diff across 7 files
View on GitHub
unknown unknown commented on Aug 20, 2026 19:49 UTC
Author

ARO-26725

What

Groundwork for retiring the file-based identity container broker. Adds the parent-side MI pool allocator, container cleanup functions, and the child-side env-var consumer path — without changing any existing runtime behavior. The new code paths only activate when ASSIGNED_MI_CONTAINERS is set by a future OTE integration (blocked on openshift-eng/openshift-tests-extension#79).

  • Remove MI demand pre-sort — delete miDemandPriority, ARO_HCP_DISABLE_MI_SORT kill switch, and associated tests; the ResourcePools scheduler enforces capacity/fairness (validated in ARO-26726)

  • Add mipool.Pool (test/cmd/aro-hcp-tests/internal/mipool/pool.go) — thread-safe parent-side allocator with Allocate, Release, and ReleaseWithCleanup

  • Add mipool.CleanupContainer / CleanupAllContainers (cleanup.go) — standalone functions to sweep residual FICs and role assignments from containers at startup or after child exit

  • Add env-var consumer path in identities_helper.go — AssignIdentityContainers and getLeasedIdentities check ASSIGNED_MI_CONTAINERS first; when unset (current state), the existing file-based path runs unchanged
  • Why

    ARO-26725 replaces the file-based identity container broker with parent-side allocation via environment variable injection. The file-based broker has three known bugs (release-before-cleanup, lock held during API calls, no stale entry recovery) that the new design eliminates by construction. This PR lands the pieces that can proceed without the OTE dependency, keeping the branch small and reviewable while unblocking future integration work.

    Testing

  • Unit tests (26 new):

  • - mipool/pool_test.go — 19 tests covering New, Allocate, Release, ReleaseWithCleanup, FormatEnv, AllContainers, concurrent access (with -race)
    - identities_helper_test.go — 7 new tests for the env-var consumer path (TestAssignFromEnv, TestLeaseFromEnv, TestAssignFromEnvThenLeaseFromEnv)
  • No new integration or E2E tests — the new code paths are not reachable at runtime until ASSIGNED_MI_CONTAINERS is set by a future PR (5f), so there is nothing to exercise end-to-end yet.
  • What the pre-merge CI jobs will verify:

  • e2e-parallel and other E2E jobs confirm no regressions from the sort removal and the new env-var branch in identities_helper.go. Because ASSIGNED_MI_CONTAINERS is never set in CI, AssignIdentityContainers evaluates the env var as empty, skips the new path, and falls through to the existing file-based code. Every E2E test follows exactly the same runtime path as on main.

  • make lint / make test / make verify confirm the new code compiles, passes lint, and the unit test suite is green.
  • What the pre-merge CI jobs will NOT verify:

  • The mipool.Pool allocator is not imported by main.go — it is an unwired library. No CI job exercises it at runtime.

  • The env-var consumer path (assignFromEnv, leaseFromEnv) is unreachable because nothing sets ASSIGNED_MI_CONTAINERS. It is covered only by unit tests.

  • CleanupContainer / CleanupAllContainers require live Azure clients and are not called from any entrypoint. The startup sweep and post-child cleanup will be wired in sub-task 5f after OTE PR #79 merges.
  • Special notes for your reviewer

    The mipool package is intentionally unwired from main.go. It will be connected via AddBeforeSpawn in a follow-up PR once OTE PR #79 merges and provides the Env field + SpawnProcessToRunTestWithEnv hook. At that point the file-based broker code can be deleted (sub-task 5h).

    PR Checklist

  • 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 graph/UI/metrics changes) — N/A

  • 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

  • All comment threads resolved before merge
  • 🤖 Generated with Claude Code

    Diff: 568 lines (+426 / -142) across 7 files Reviewer: mgahagan73 Review duration: 75304m
    All Vouch review confidence checks passed
    Residual risk 0.31 = Change Risk (0.57) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 568 lines diff across 7 files
    0.57
    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.380
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6635"
    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: 56.7% (MEDIUM) · Higher = larger blast radius
    56.7%
    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: 31.4% · Safe to merge
    31.4%
    Repository