Skip to content

Add CSV field to disable role aggregation - #537

Open
joelanford wants to merge 1 commit into
operator-framework:masterfrom
joelanford:add-csv-disable-role-aggregation
Open

joelanford wants to merge 1 commit into
operator-framework:masterfrom
joelanford:add-csv-disable-role-aggregation

Conversation

@joelanford

@joelanford joelanford commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Add an optional spec.disableRoleAggregation field to
ClusterServiceVersion, allowing operator bundles to express an opt-out
from OLM standard role aggregation for provided APIs.

By default, OLM aggregates permissions for provided APIs into the
standard admin, edit, and view roles. This field provides an explicit
way to request that those permissions not be automatically aggregated,
while retaining the ClusterRoles that OLM creates and maintains.

Changes

  • Add DisableRoleAggregation to ClusterServiceVersionSpec as an
    optional boolean with the JSON name disableRoleAggregation.
  • Preserve the existing default behavior when the field is omitted or
    set to false.
  • Document the intended behavior when the field is true: continue
    maintaining the ClusterRoles for provided APIs, but omit their role
    aggregation labels.
  • Document the upgrade implications for users who rely on aggregated
    permissions. Those users may require separate role bindings to retain
    access to the provided APIs.
  • Update the generated ClusterServiceVersion CRD, embedded CRD data, and
    OpenAPI definitions.

This PR adds the API field and schema support only. Runtime enforcement
of the setting belongs in OLM.

Test plan

  • Run make test-unit on the change rebased onto current upstream
    master.
  • Run make verify from a clean jj working copy after rebasing and
    resolving the embedded CRD conflict. Generation, formatting, module
    verification, and the final clean-diff check all pass.

Generated with the assistance of generative AI

Summary by CodeRabbit

  • New Features
    • Operators can configure whether roles created for provided APIs receive cluster role aggregation labels. Aggregation remains enabled by default; setting the option to true omits those labels while the roles continue to be created and maintained.
    • Without aggregation labels, equivalent permissions may need to be granted separately through role bindings.

@openshift-ci
openshift-ci Bot requested review from grokspawn and oceanc80 November 17, 2026 19:14
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ClusterServiceVersion spec adds the optional disableRoleAggregation field. The CRD schema documents its default and stated access effects. The embedded CRD data is updated to include the schema change.

Changes: CSV role aggregation field

Layer / File(s) Summary
Spec field and CRD schema
pkg/operators/v1alpha1/clusterserviceversion_types.go, crds/operators.coreos.com_clusterserviceversions.yaml, crds/zz_defs.go
The CSV spec and CRD schema add the optional disableRoleAggregation field. The embedded CRD asset is replaced with the updated data.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Possibly related PRs

Suggested reviewers: tmshort, rashmigottipati

Merge Risk: Minimal · up to 250eb

This change adds an optional role aggregation setting to the ClusterServiceVersion API and schema. Omitting it preserves current behavior, and the embedded CRD matches the schema. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add CSV field to disable role aggregation" matches the main change. The PR adds an optional spec.disableRoleAggregation boolean to ClusterServiceVersionSpec. The title names the new field a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add CSV field to disable role aggregation" matches the main change. The PR adds an optional spec.disableRoleAggregation boolean to ClusterServiceVersionSpec. The title names the new field and its purpose, and it stays concise. The title does not mention that the change also updates the generated CRD and embedded data, but that detail is not required.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: c40b91a4-b848-41da-9765-7d0fa194baaf
Commits

Reviewing files that changed from the base of the PR and between 8a12de1 and 250eb70.

Files ignored due to path filters: 1

  • pkg/generated/openapi/zz_generated.openapi.go is excluded by !**/generated/**
Files selected for processing: 3

  • crds/operators.coreos.com_clusterserviceversions.yaml
  • crds/zz_defs.go
  • pkg/operators/v1alpha1/clusterserviceversion_types.go

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.30%. Comparing base (e1a542c) to head (250eb70).

Files with missing lines Patch % Lines
pkg/generated/openapi/zz_generated.openapi.go 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #537      +/-   ##
==========================================
- Coverage   22.33%   22.30%   -0.03%     
==========================================
  Files          60       60              
  Lines        7872     7880       +8     
==========================================
  Hits         1758     1758              
- Misses       5962     5970       +8     
  Partials      152      152              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add an optional spec.disableRoleAggregation boolean to
ClusterServiceVersion so operator bundles can express whether OLM should
disable aggregation of roles for their provided APIs. Omitting the field
or setting it to false preserves the existing default behavior.

Document the intended behavior when the field is enabled: OLM continues
creating and maintaining ClusterRoles for provided APIs, but omits their
role aggregation labels. Also document the upgrade implications for users
whose access currently depends on aggregation into the standard admin,
edit, and view roles.

Update the generated ClusterServiceVersion CRD, embedded CRD data, and
OpenAPI definitions to expose the new field consistently. This change
provides the API surface only; runtime enforcement belongs in OLM.

Co-Authored-By: GPT-6.1 Sol
@joelanford
joelanford force-pushed the add-csv-disable-role-aggregation branch from 8a12de1 to 250eb70 Compare November 17, 2026 19:25
@tmshort

tmshort commented Nov 17, 2026

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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 Nov 17, 2026
@joelanford

Copy link
Copy Markdown
Member Author

/hold

We need to decide if we want to use a spec-based approach (which has better schema validation and discoverability UX, but isn't as forward-compatible) OR if we use an annotation-based approach (which has better update UX, but loses the schema validation and discoverability)

Many OLM catalogs are curated for specific minor versions of kubernetes, not for specific versions of OLM. This mismatch means that an old OLM version might update an operator that includes this new field in its CSV. However that old OLM version does not have the new field in its CRD schema, which means the new field will be dropped from the CSV during the operator update. If/when the OLM version eventually is updated to the version that includes the new CRD schema, it is too late. The field has already been dropped, and OLM does not re-apply the CSV except during operator installations or updates.

Therefore the spec-based approach will require an update of OLM followed by one of:

  • operator update
  • operator uninstall/reinstall

We believe (though haven't yet verified as of 11/17/2026) that an annotation-based approach would enable the operator update to occur prior to the OLM update (the annotation would be persisted in etcd, but old OLM would not know about it). After the OLM update, we think the annotation would be discovered and the aggregation labels would be removed without requiring a subsequent update or uninstall/reinstall.

@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 Nov 17, 2026
// field may cause users who rely on aggregated permissions to lose access
// to those APIs unless equivalent permissions are granted through separate
// RoleBindings or ClusterRoleBindings.
// +optional

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh, we also need to make this field immutable so that users are not able to modify it away from operator author intent.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants