Skip to content

[release-4.22] OCPBUGS-84632: fix(azure): detect and replace stale role assignments on cluster re-creation - #8359

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:release-4.22from
openshift-cherrypick-robot:cherry-pick-8322-to-release-4.22
Apr 29, 2026
Merged

[release-4.22] OCPBUGS-84632: fix(azure): detect and replace stale role assignments on cluster re-creation#8359
openshift-merge-bot[bot] merged 2 commits into
openshift:release-4.22from
openshift-cherrypick-robot:cherry-pick-8322-to-release-4.22

Conversation

@openshift-cherrypick-robot

Copy link
Copy Markdown

This is an automated cherry-pick of #8322

/assign openshift-ci-robot

…re-creation

- Extract roleAssignmentClient interface from Azure SDK for testability
- Add LIST-based existence check with atScope() filter before GET fallback
- Verify both PrincipalID and RoleDefinitionID before skipping creation
- Delete stale assignments (mismatched principal) and create fresh ones
- Add CleanupRoleAssignments to both destroy cluster and destroy iam paths
- Make --dns-zone-rg-name required on all destroy commands
- Add comprehensive behavior-driven tests for assignRole, deleteRoleAssignmentByName,
  and cleanupRoleAssignments

Signed-off-by: Bryan Cox <brcox@redhat.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
Update destroy command examples in self-managed Azure cluster,
IAM separate workflow, and private cluster docs to include the
now-required --dns-zone-rg-name flag. Also update the destroy iam
command reference table with all required flags.

Signed-off-by: Bryan Cox <brcox@redhat.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
@openshift-ci-robot

Copy link
Copy Markdown

@openshift-cherrypick-robot: Detected clone of Jira Issue OCPBUGS-84251 with correct target version. Will retitle the PR to link to the clone.
/retitle [release-4.22] OCPBUGS-84632: fix(azure): detect and replace stale role assignments on cluster re-creation

Details

In response to this:

This is an automated cherry-pick of #8322

/assign openshift-ci-robot

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 02a23971-db89-4861-a4ce-55c9e39f1a12

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot changed the title [release-4.22] OCPBUGS-84251: fix(azure): detect and replace stale role assignments on cluster re-creation [release-4.22] OCPBUGS-84632: fix(azure): detect and replace stale role assignments on cluster re-creation Apr 28, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@openshift-cherrypick-robot: This pull request references Jira Issue OCPBUGS-84632, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

This is an automated cherry-pick of #8322

/assign openshift-ci-robot

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from csrwng and devguyio April 28, 2026 15:11
@openshift-ci openshift-ci Bot added area/cli Indicates the PR includes changes for CLI area/documentation Indicates the PR includes changes for documentation area/platform/azure PR/issue for Azure (AzurePlatform) platform and removed do-not-merge/needs-area labels Apr 28, 2026
@bryan-cox

Copy link
Copy Markdown
Member

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request references Jira Issue OCPBUGS-84632, which is invalid:

  • release note text must be set and not match the template OR release note type must be set to "Release Note Not Required". For more information you can reference the OpenShift Bug Process.

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox

Copy link
Copy Markdown
Member

/approve
/lgtm

clean backport

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 28, 2026
@openshift-ci

openshift-ci Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, openshift-cherrypick-robot

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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 28, 2026
@bryan-cox

Copy link
Copy Markdown
Member

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 28, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request references Jira Issue OCPBUGS-84632, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-84251 is in the state Verified, which is one of the valid states (MODIFIED, ON_QA, VERIFIED)
  • dependent Jira Issue OCPBUGS-84251 targets the "5.0.0" version, which is one of the valid target versions: 5.0.0
  • bug has dependents
Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.93706% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.74%. Comparing base (293c70e) to head (6de6079).
⚠️ Report is 3 commits behind head on release-4.22.

Files with missing lines Patch % Lines
cmd/cluster/azure/destroy.go 0.00% 18 Missing ⚠️
cmd/infra/azure/rbac.go 82.85% 18 Missing ⚠️
cmd/infra/azure/destroy_iam.go 16.66% 15 Missing ⚠️
product-cli/cmd/cluster/azure/destroy.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release-4.22    #8359      +/-   ##
================================================
+ Coverage         34.64%   34.74%   +0.10%     
================================================
  Files               767      767              
  Lines             93192    93310     +118     
================================================
+ Hits              32284    32421     +137     
+ Misses            58233    58214      -19     
  Partials           2675     2675              
Files with missing lines Coverage Δ
cmd/cluster/core/destroy.go 8.91% <ø> (ø)
product-cli/cmd/cluster/azure/destroy.go 0.00% <0.00%> (ø)
cmd/infra/azure/destroy_iam.go 20.68% <16.66%> (-0.53%) ⬇️
cmd/cluster/azure/destroy.go 17.74% <0.00%> (-3.02%) ⬇️
cmd/infra/azure/rbac.go 47.18% <82.85%> (+47.18%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci

openshift-ci Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

@openshift-cherrypick-robot: all tests passed!

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.

@Nirshal

Nirshal commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 29, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@Nirshal: This PR has been marked as verified by @Nirshal (see: https://redhat.atlassian.net/browse/OCPBUGS-84632?focusedCommentId=16835987).

Details

In response to this:

/verified by @Nirshal (see: https://redhat.atlassian.net/browse/OCPBUGS-84632?focusedCommentId=16835987)

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 openshift-eng/jira-lifecycle-plugin repository.

@csrwng

csrwng commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

/label backport-risk-assessed

@openshift-ci openshift-ci Bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Apr 29, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 5fb05fe into openshift:release-4.22 Apr 29, 2026
17 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@openshift-cherrypick-robot: Jira Issue Verification Checks: Jira Issue OCPBUGS-84632
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-84632 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

This is an automated cherry-pick of #8322

/assign openshift-ci-robot

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

Fix included in release 4.22.0-0.nightly-2026-04-29-175947

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cli Indicates the PR includes changes for CLI area/documentation Indicates the PR includes changes for documentation area/platform/azure PR/issue for Azure (AzurePlatform) platform backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants