Skip to content

🐛 add create verb to boxcutter preflight#2587

Open
kuiwang02 wants to merge 1 commit intooperator-framework:mainfrom
kuiwang02:fix78211
Open

🐛 add create verb to boxcutter preflight#2587
kuiwang02 wants to merge 1 commit intooperator-framework:mainfrom
kuiwang02:fix78211

Conversation

@kuiwang02
Copy link

Summary

Fixes Boxcutter applier's preflight permission check to properly validate namespace-scoped CREATE permissions.

Problem

After PR #2539, the Boxcutter applier's RBACPreAuthorizer was missing the WithNamespacedCollectionVerbs("create") configuration. This caused the preflight check to pass without validating CREATE permissions, leading to installation failures when the applier attempted to create resources like ServiceAccounts.

The Helm applier was correctly configured with this option (line 746), but the Boxcutter applier configuration (line 620) was missing it.

Changes

  • Added WithNamespacedCollectionVerbs("create") to Boxcutter's RBACPreAuthorizer instantiation in boxcutterReconcilerConfigurator.Configure()

Note: Boxcutter does not need WithClusterCollectionVerbs("list", "watch") because it doesn't use the contentmanager component, unlike the Helm applier.

Related Issues

Assisted-By: Claude Code

Copilot AI review requested due to automatic review settings March 24, 2026 05:30
@openshift-ci openshift-ci bot requested review from pedjak and trgeiger March 24, 2026 05:30
@netlify
Copy link

netlify bot commented Mar 24, 2026

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 99fe9fc
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69c64f4c2a16bd0008becce9
😎 Deploy Preview https://deploy-preview-2587--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Boxcutter applier preflight RBAC validation so it correctly checks for namespace-scoped CREATE permissions, preventing installs from passing preflight but failing later when creating namespaced resources (e.g., ServiceAccounts).

Changes:

  • Configure Boxcutter’s RBACPreAuthorizer with WithNamespacedCollectionVerbs("create") under the PreflightPermissions feature gate.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kuiwang02 kuiwang02 changed the title 🐛add create verb to boxcutter preflight 🐛 add create verb to boxcutter preflight Mar 24, 2026
@kuiwang02 kuiwang02 changed the title 🐛 add create verb to boxcutter preflight Patch fix: 🐛 (:bug:) add create verb to boxcutter preflight Mar 24, 2026
@kuiwang02 kuiwang02 changed the title Patch fix: 🐛 (:bug:) add create verb to boxcutter preflight 🐛 add create verb to boxcutter preflight Mar 24, 2026
@kuiwang02
Copy link
Author

/cc @perdasilva

@openshift-ci openshift-ci bot requested a review from perdasilva March 24, 2026 05:37
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.51%. Comparing base (a307a6d) to head (99fe9fc).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2587      +/-   ##
==========================================
+ Coverage   65.84%   68.51%   +2.66%     
==========================================
  Files         137      137              
  Lines        9560     9583      +23     
==========================================
+ Hits         6295     6566     +271     
+ Misses       2795     2520     -275     
- Partials      470      497      +27     
Flag Coverage Δ
e2e 38.75% <0.00%> (+27.56%) ⬆️
experimental-e2e 51.91% <100.00%> (+0.84%) ⬆️
unit 52.94% <0.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@fgiudici fgiudici left a comment

Choose a reason for hiding this comment

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

LGTM. Good catch!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2026
Copy link
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

please add e2e tests that assert the change.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2026
@kuiwang02
Copy link
Author

LGTM. Good catch!

@fgiudici Thanks!

@kuiwang02
Copy link
Author

please add e2e tests that assert the change.

@pedjak I add e2e cases for the change and it passes. could you please review it again? Thanks

@tmshort
Copy link
Contributor

tmshort commented Mar 25, 2026

/approve

@openshift-ci
Copy link

openshift-ci bot commented Mar 25, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgiudici, 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 Mar 25, 2026
@kuiwang02 kuiwang02 requested a review from pedjak March 25, 2026 23:54
@kuiwang02
Copy link
Author

@pedjak could you please review it again? thanks.

@jianzhangbjz
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 27, 2026
@tmshort
Copy link
Contributor

tmshort commented Mar 27, 2026

ping @pedjak

@@ -0,0 +1,68 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

this file is not needed, because we execute the new test only with boxcutter runtime.

Copy link
Author

Choose a reason for hiding this comment

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

done, thanks

Copilot AI review requested due to automatic review settings March 27, 2026 07:23
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 27, 2026
@openshift-ci
Copy link

openshift-ci bot commented Mar 27, 2026

New changes are detected. LGTM label has been removed.

Copy link
Contributor

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pedjak
Copy link
Contributor

pedjak commented Mar 27, 2026

@perdasilva would like to have a look at PR?

// Note: This function is specifically for Boxcutter runtime tests (requires @BoxcutterRuntime tag).
func ServiceAccountWithoutCreatePermissionsIsAvailableInTestNamespace(ctx context.Context, serviceAccount string) error {
// This test is only valid with Boxcutter runtime enabled
if enabled, found := featureGates[features.BoxcutterRuntime]; !found || !enabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be worth moving this to a helper function? e.g.

func IsFeatureGateEnabled(feature featuregate.Feature) bool {
  enabled, found := featureGates[feature]
  return enabled && found

or something like that?

Copy link
Author

Choose a reason for hiding this comment

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

done, thanks

Copilot AI review requested due to automatic review settings March 27, 2026 09:07
Copy link
Contributor

Copilot AI left a comment

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 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants