Skip to content

[oadp-1.5] OADP-6540: Skip restore of k8s RBAC system rolebindings#404

Open
kaovilai wants to merge 3 commits into
openshift:oadp-1.5from
kaovilai:OADP-6540-oadp-1.5
Open

[oadp-1.5] OADP-6540: Skip restore of k8s RBAC system rolebindings#404
kaovilai wants to merge 3 commits into
openshift:oadp-1.5from
kaovilai:OADP-6540-oadp-1.5

Conversation

@kaovilai

@kaovilai kaovilai commented Jun 8, 2026

Copy link
Copy Markdown
Member

Cherry-pick of #402 to oadp-1.5.

Problem

When restoring with namespace mapping (e.g. ns-ans-b), pods in the target namespace fail with ErrImagePull because OpenShift auto-creates system:image-pullers with subjects pointing to the correct target namespace (system:serviceaccounts:ns-b), but Velero also restores the backed-up rbac.authorization.k8s.io/v1/RoleBinding which overwrites it with subjects still pointing to the source namespace (system:serviceaccounts:ns-a). Service accounts in ns-b then lack pull permissions.

PR #311 fixed this for authorization.openshift.io rolebindings, but not for rbac.authorization.k8s.io — both API groups are backed up because rolebindings is not in Velero's cohabitating resources dedup list.

Fix

Skip the same three system rolebindings (system:image-pullers, system:image-builders, system:deployers) for the rbac.authorization.k8s.io API group. OpenShift creates these automatically with correct subject namespace references when a project is created.

Verification

Tested with OADP 1.6.0 downstream build on OCP 5.0 (arm64):

  • FBC: quay.io/redhat-user-workloads/ocp-art-tenant/art-fbc:v5.0__operator_nvr__oadp-operator-container-1.6.0-202606041057.p2.g747216b.assembly.stream.el9
  • Plugin override: quay.io/tkaovila/openshift-velero-plugin:[OADP-6540](https://redhat.atlassian.net/browse/OADP-6540) via DPA unsupportedOverrides.openshiftPluginImageFqin

Both rbac.authorization.k8s.io and authorization.openshift.io system rolebindings now skipped. Subjects in target namespace correctly reference system:serviceaccounts:test-rb-target.

Fixes: https://issues.redhat.com/browse/OADP-6540

🤖 Generated with Claude Code

kaovilai and others added 2 commits June 8, 2026 13:39
PR openshift#311 added skip logic for system rolebindings (system:image-pullers,
system:image-builders, system:deployers) but only for the
authorization.openshift.io API group. OpenShift stores these as
rbac.authorization.k8s.io objects and exposes them via both API groups.
Velero backs up both variants since rolebindings are not in Velero's
cohabitating resources dedup list.

During restore with namespace mapping, the k8s RBAC variants were
restored with stale subject references (old namespace), overwriting
the correct auto-created rolebindings and causing ErrImagePull.

Add a new RestoreItemAction for rolebindings (rbac.authorization.k8s.io)
that skips the same system rolebindings, letting OpenShift create them
with correct namespace references.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@openshift-ci-robot

openshift-ci-robot commented Jun 8, 2026

Copy link
Copy Markdown

@kaovilai: This pull request references OADP-6540 which is a valid jira issue.

Details

In response to this:

Cherry-pick of #402 to oadp-1.5.

Summary

  • Add K8sRestorePlugin for rolebindings (rbac.authorization.k8s.io) that skips system rolebindings (system:image-pullers, system:image-builders, system:deployers)
  • Fixes namespace mapping restore causing ErrImagePull due to stale subject references

Verification

Tested with OADP 1.6.0 downstream build on OCP 5.0 (arm64):

  • FBC: quay.io/redhat-user-workloads/ocp-art-tenant/art-fbc:v5.0__operator_nvr__oadp-operator-container-1.6.0-202606041057.p2.g747216b.assembly.stream.el9
  • Plugin override: quay.io/tkaovila/openshift-velero-plugin:[OADP-6540](https://redhat.atlassian.net/browse/OADP-6540) via DPA unsupportedOverrides.openshiftPluginImageFqin

Both rbac.authorization.k8s.io and authorization.openshift.io system rolebindings now skipped. Subjects in target namespace correctly reference test-rb-target.

Fixes: https://issues.redhat.com/browse/OADP-6540

🤖 Generated with Claude Code

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-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 8, 2026
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 8, 2026
@kaovilai kaovilai changed the title OADP-6540: Skip restore of k8s RBAC system rolebindings [oadp-1.5] OADP-6540: Skip restore of k8s RBAC system rolebindings Jun 8, 2026
TestGetRegistryEnvsForLocation was hitting real S3 to determine
bucket region, causing CI failures when no AWS credentials are
available. Mock GetBucketRegionFunc like s3_test.go and
registry_test.go already do.

Also fix wantErrString to match the full wrapped error from
GetRegistryEnvsForLocation.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@kaovilai kaovilai force-pushed the OADP-6540-oadp-1.5 branch from 976e010 to d2883cd Compare June 8, 2026 18:06
@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown

@kaovilai: 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.

@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai, sseago

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

@sseago

sseago commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

/lgtm

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

Copy link
Copy Markdown
Contributor

hold for @PrasadJoshi12 to test before merge please.

@kaovilai

kaovilai commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 8, 2026
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants