Skip to content

fix(cleanup): protect identity pools from expiry (AROSLSRE-1916) - #6706

Merged
Rael Garcia (raelga) merged 2 commits into
Azure:mainfrom
raelga:raelga/arosslsre-1916-protect-identity-pools
Aug 28, 2026
Merged

fix(cleanup): protect identity pools from expiry (AROSLSRE-1916)#6706
Rael Garcia (raelga) merged 2 commits into
Azure:mainfrom
raelga:raelga/arosslsre-1916-protect-identity-pools

Conversation

@raelga

Copy link
Copy Markdown
Collaborator

AROSLSRE-1916

What

Excludes slot-managed identity-container resource groups from
cleanup-sweeper discovery before the generic 15-day persist=true expiry
rule.

Adds regression coverage against the repository policy and documents why these
long-lived E2E pools are protected.

Why

The restored DEV shard0 pool has 300 resource groups with persist=true, a
newly stamped createdAt, and no managedBy parent. Without this exclusion,
the four-hour cleanup sweeper would select the entire pool after 15 days and
reintroduce the ResourceGroupNotFound failures recovered under AROSLSRE-1895.

Testing

  • cd tooling/cleanup-sweeper && go test ./...
  • GOTOOLCHAIN=go1.25.7 make verify-yamlfmt
  • The regression test loads resourcegroups.policy.yaml and verifies:
    • an identity-container group older than 15 days is skipped
    • matching is case-insensitive
    • an unrelated persist=true group still expires after 15 days

Special notes for your reviewer

This changes the policy consumed by the periodic sweeper-rg-ordered CI job.
The exclusion is intentionally narrow to resource-group names beginning with
aro-hcp-msi-container-.

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) - not applicable
  • Self-reviewed the diff
  • CI/CD checks are passing (ignore Tide)
  • Draft PR used for WIP (if applicable) - not applicable
  • Commit history is clean (rebased/squashed)
  • Tricky code blocks are commented
  • Specific reviewers tagged
  • All comment threads resolved before merge

If E2E tests are included:

  • E2E tests follow Principles of Good E2E Test Case Design - not applicable
  • If new E2E use case is covered (via a new test or new check/verifier),
    demonstrate that the test is able to detect a defect/error and fail with
    proper error message and logs which communicates nature of the problem. - not applicable

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the cleanup-sweeper rg-ordered discovery policy to avoid selecting long-lived slot-managed MSI container resource groups for deletion under the generic persist=true 15-day rule, and adds a regression test plus documentation to prevent reintroducing the issue.

Changes:

  • Add an ordered skip rule to exclude resource groups whose names start with aro-hcp-msi-container- (case-insensitive) before the generic persist=true expiry rule.
  • Add a regression test that loads the repository policy file and asserts the skip behavior and case-insensitive matching.
  • Document the rationale for excluding these long-lived identity-container pools in cleanup CI docs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tooling/cleanup-sweeper/resourcegroups.policy.yaml Adds a new first-match skip rule to exclude identity-container pools by name regex before persist=true expiration rules.
tooling/cleanup-sweeper/pkg/policy/policy_test.go Adds a regression test that loads/validates the repo policy and verifies identity-container pools are skipped while unrelated persist=true RGs still expire.
docs/ci/cleanup.md Documents why identity-container pools are excluded from rg-ordered deletion candidates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 27, 2026 14:00
@raelga

Copy link
Copy Markdown
Collaborator Author

Gerd Oberlechner (@geoberle) Steve Kuznetsov (@stevekuznetsov) The gci failure is fixed in 812783e71; targeted golangci-lint and the full cleanup-sweeper test suite pass locally. CI is rerunning on the fixed SHA. Could one of you please review and /lgtm when satisfied?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

tooling/cleanup-sweeper/pkg/policy/policy_test.go:110

  • Subtest is marked t.Parallel() inside a range loop but captures the loop variable tc by reference. This can make the assertions run with the wrong test case (flaky / incorrect) once the loop advances.
	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {
			t.Parallel()

@raelga

Copy link
Copy Markdown
Collaborator Author

Copilot Reviewed the suppressed loop-variable note: no change is needed. This repository targets Go 1.25.7 (go.work), so range variables use per-iteration semantics and the parallel subtests do not share a captured tc. The same established pattern is already used throughout this package. No further action or commit needed from you, this is resolved.

@raelga

Copy link
Copy Markdown
Collaborator Author

/retest

@raelga

Copy link
Copy Markdown
Collaborator Author

/test image-updater-images

@raelga

Copy link
Copy Markdown
Collaborator Author

/retest

2 similar comments
@raelga

Copy link
Copy Markdown
Collaborator Author

/retest

@raelga

Copy link
Copy Markdown
Collaborator Author

/retest

@stevekuznetsov

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci

openshift-ci Bot commented Aug 27, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: raelga, stevekuznetsov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD f9b2c34 and 2 for PR HEAD 812783e in total

@raelga

Copy link
Copy Markdown
Collaborator Author

/test e2e-parallel

Retesting: the KMS-key-rotation cluster provisioning failed with:

InternalServerError: [hypershiftHostedCluster] hosted cluster has no installed version; hosted cluster degraded: UnavailableReplicas: router deployment has 1 unavailable replicas

This is a guest-cluster data-plane/router provisioning issue, not related to this PR's identity-pool cleanup policy diff. The identical signature also hit #6708 (unrelated ARM-retry PR) in the same time window, confirming a shared-CI infra episode rather than a PR-specific problem.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD ddbf464 and 1 for PR HEAD 812783e in total

@raelga

Copy link
Copy Markdown
Collaborator Author

/retest

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 339c3a8 and 0 for PR HEAD 812783e in total

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/hold

Revision 812783e was retested 3 times: holding

@raelga

Copy link
Copy Markdown
Collaborator Author

/unhold
/retest

@openshift-ci

openshift-ci Bot commented Aug 28, 2026

Copy link
Copy Markdown

Rael Garcia (@raelga): The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-parallel 812783e link true /test e2e-parallel

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@raelga

Copy link
Copy Markdown
Collaborator Author

Active incident: cleanup sweeper deleted the DEV identity pools

Azure Activity Log confirms that the scheduled cleanup identity (OpenShift Release Bot, object ID c209f8df-52ae-48fb-98ea-380f58b04652) deleted the identity-container resource groups while this PR was waiting on E2E:

  • aro-hcp-msi-container-dev-shard3-02-30: deleted at 2026-08-26 21:43 UTC
  • aro-hcp-msi-container-dev-shard3-04-16: deleted at 2026-08-27 01:38 UTC
  • shard1 deletion continued through aro-hcp-msi-container-dev-shard1-02-39 at 2026-08-28 08:57 UTC

The deleting job is sweeper-rg-ordered run 2093248516318040064. It runs every four hours and checked out main without this PR's exclusion, so identity pools continued matching the catch-all 15-day persist=true rule.

The complete DEV validation before recovery found:

Pool Resource groups Managed identities
shard0 300/300 3,900/3,900
shard1 163/300 2,115/3,900, plus 4 identities missing from an existing group
shard2 0/300 0/3,900
shard3 0/300 0/3,900

This directly caused E2E run 2093225833677197312 to finish with 55 failed, 5 passed, and 40 skipped tests. At least 54 distinct shard3 resource groups were reported as missing; this is environmental fallout from the cleanup policy, not a failure caused by this three-file policy/docs/test change.

Containment and recovery are in progress:

  • Temporarily removed only the cleanup bot's Contributor assignment from the three damaged subscriptions.
  • Applied temporary CanNotDelete locks to stop the already-running sweeper after its cached authorization continued briefly.
  • No identity-pool resource group has been successfully deleted after shard1 02-39 at 08:57 UTC.
  • Current recovery: shard1 has 300/300 groups and 3,898/3,900 identities; shards2 and 3 each have 180/300 groups and 2,340/3,900 identities. Scoped deployment-stack reconciliation is still running through the remaining slots.

After reconciliation completes, I will run the full catalog validator, restore the cleanup bot's role assignment, remove temporary locks, and retest E2E. Merging this PR is the durable containment required before the next aged pool can be selected again.

@raelga

Copy link
Copy Markdown
Collaborator Author

Recovery validation complete

The complete catalog-driven DEV validation now passes for every managed pool:

Pool Resource groups Managed identities Result
shard0 300/300 3,900/3,900 valid
shard1 300/300 3,900/3,900 valid
shard2 300/300 3,900/3,900 valid
shard3 300/300 3,900/3,900 valid

There are no missing or unexpected resource groups or identities. Every recovered group has a fresh createdAt timestamp between 08:40 and 09:33 UTC.

Temporary incident containment has been fully rolled back:

  • The OpenShift Release Bot Contributor assignments were restored with their original role-assignment IDs on all three affected subscriptions.
  • All 498 temporary CanNotDelete locks were removed and each subscription now reports zero incident locks.
  • The destructive sweeper run completed, and no identity pool deletion succeeded after shard1 02-39 at 08:57 UTC.

The current #6706 E2E run remains in progress and has not reported any identity-pool ResourceGroupNotFound errors. #6648 is already retesting; #6680 has been retriggered against the restored inventory.

@raelga

Copy link
Copy Markdown
Collaborator Author

Force-merge justification

This is an exceptional green-but-blocked infrastructure fix needed to break a circular dependency: the required E2E check cannot complete reliably because the cleanup policy being fixed is actively deleting the identity pools that E2E requires. It meets all four force-merge criteria:

1. The merge queue is blocked by the problem.

The four-hour sweeper-rg-ordered periodic continues to run from main without this PR's exclusion and has deleted the DEV identity pools used by required presubmit E2E tests. E2E run 2093225833677197312 finished with 55 failed, 5 passed, and 40 skipped tests; at least 54 distinct shard3 identity-container resource groups were reported missing. The same failure blocked unrelated #6648 and #6680.

This creates a circular gate: #6706 cannot merge without E2E, while E2E cannot run reliably until #6706 prevents the sweeper from deleting its prerequisites.

2. High confidence this change fixes the problem.

Azure Activity Log identifies OpenShift Release Bot—the identity used by the cleanup periodic—as the caller that deleted the affected resource groups. The active sweeper-rg-ordered run continued deleting shard1 groups through 08:57 UTC.

This PR adds a narrow, first-match, case-insensitive exclusion for resource-group names beginning with aro-hcp-msi-container- before the generic 15-day persist=true deletion rule. The regression test loads the real repository policy and proves that identity-container groups are skipped while unrelated persistent groups remain eligible for expiry.

3. The change builds and passes all fast testing.

All non-E2E required checks are green: unit tests, integration, lint, verify, mega-linter, images, E2E images, config-change detection, GitHub analysis, and CLA. Tide is merge automation rather than a CI check. Local cleanup-sweeper tests and YAML verification also pass.

4. The change is clean and authored by the original PR author.

This is a focused three-file change by Rael Garcia (@raelga): one policy exclusion, regression coverage, and the corresponding cleanup documentation. It contains no unrelated refactoring or production-service changes and has already received lgtm and approved.

Temporary RBAC containment and deletion locks are currently required while the three damaged subscriptions are reconciled. Force-merging #6706 removes the deletion source, allows those temporary controls to be removed, and restores a stable environment for the required E2E retest.

@raelga
Rael Garcia (raelga) merged commit 6a34644 into Azure:main Aug 28, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants