Skip to content

CMP-4425: Grant scanner RBAC for OpenShift Virtualization resources#1293

Open
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:cmp-4425-ocpvirt-scanner-rbac
Open

CMP-4425: Grant scanner RBAC for OpenShift Virtualization resources#1293
Vincent056 wants to merge 1 commit into
ComplianceAsCode:masterfrom
Vincent056:cmp-4425-ocpvirt-scanner-rbac

Conversation

@Vincent056

Copy link
Copy Markdown

What

Adds get/list/watch RBAC to the api-resource-collector ClusterRole for the OpenShift Virtualization resource types needed by the CIS OpenShift Virtualization benchmark CEL content:

  • kubevirt.io — virtualmachines, virtualmachineinstances
  • instancetype.kubevirt.io — virtualmachineclusterinstancetypes, virtualmachineclusterpreferences
  • cdi.kubevirt.io — cdis
  • k8s.cni.cncf.io — network-attachment-definitions, multi-networkpolicies
  • sriovnetwork.openshift.io — sriovnetworks

(hco.kubevirt.io is already granted.) The CSV clusterPermissions were regenerated via make bundle.

Why

The CEL scanner runs as the api-resource-collector service account, whose ClusterRole is a curated allow-list (no wildcard). When a CEL rule references a resource the SA cannot read, the fetch is denied and the SDK degrades to an empty resource map, which yields a misleading PASS/FAIL rather than an error. Granting read access to these OCP-Virt types lets the benchmark's VM/network rules evaluate correctly out of the box.

Testing

Read-only RBAC addition; make bundle validates clean. End-to-end validation against a CNV cluster will follow once a test cluster is available (tracked in CMP-4475).

Jira: https://issues.redhat.com/browse/CMP-4425

🤖 Generated with Claude Code

The CEL scanner runs as the api-resource-collector service account, whose
ClusterRole is a curated allow-list. CIS OpenShift Virtualization benchmark
rules need to read VirtualMachine, CDI, NetworkAttachmentDefinition and
SriovNetwork resources; without RBAC a CEL fetch degrades to an empty result
and produces misleading compliance status.

Add get/list/watch for kubevirt.io, instancetype.kubevirt.io, cdi.kubevirt.io,
k8s.cni.cncf.io and sriovnetwork.openshift.io (hco.kubevirt.io already granted),
and regenerate the CSV clusterPermissions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci-robot

Copy link
Copy Markdown
Collaborator

@Vincent056: This pull request references CMP-4425 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What

Adds get/list/watch RBAC to the api-resource-collector ClusterRole for the OpenShift Virtualization resource types needed by the CIS OpenShift Virtualization benchmark CEL content:

  • kubevirt.io — virtualmachines, virtualmachineinstances
  • instancetype.kubevirt.io — virtualmachineclusterinstancetypes, virtualmachineclusterpreferences
  • cdi.kubevirt.io — cdis
  • k8s.cni.cncf.io — network-attachment-definitions, multi-networkpolicies
  • sriovnetwork.openshift.io — sriovnetworks

(hco.kubevirt.io is already granted.) The CSV clusterPermissions were regenerated via make bundle.

Why

The CEL scanner runs as the api-resource-collector service account, whose ClusterRole is a curated allow-list (no wildcard). When a CEL rule references a resource the SA cannot read, the fetch is denied and the SDK degrades to an empty resource map, which yields a misleading PASS/FAIL rather than an error. Granting read access to these OCP-Virt types lets the benchmark's VM/network rules evaluate correctly out of the box.

Testing

Read-only RBAC addition; make bundle validates clean. End-to-end validation against a CNV cluster will follow once a test cluster is available (tracked in CMP-4475).

Jira: https://issues.redhat.com/browse/CMP-4425

🤖 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

openshift-ci Bot commented Jul 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Vincent056

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 label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🤖 To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:1293-6933e40492db0c6ecaa7d8399d17be7386f20a6f

@Vincent056 Vincent056 marked this pull request as ready for review July 6, 2026 15:18
@openshift-ci openshift-ci Bot requested review from jhrozek and xiaojiey July 6, 2026 15:18
@openshift-ci

openshift-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown

@Vincent056: 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-aws-parallel 6933e40 link true /test e2e-aws-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.

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.

2 participants