Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add installer policy rule generators #1774

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

perdasilva
Copy link
Contributor

@perdasilva perdasilva commented Feb 14, 2025

Description

Adds functions to the rukpak/convert package to generate policy rules that can be used by the installer service account / user to manage a cluster extension.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 14, 2025
Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit cdf1906
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67d7ef5bacbbd00008226102
😎 Deploy Preview https://deploy-preview-1774--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 site configuration.

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 98.11321% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.58%. Comparing base (416fbdc) to head (cdf1906).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...erator-controller/rukpak/convert/installer_rbac.go 97.43% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1774      +/-   ##
==========================================
+ Coverage   69.04%   69.58%   +0.53%     
==========================================
  Files          65       67       +2     
  Lines        5263     5363     +100     
==========================================
+ Hits         3634     3732      +98     
- Misses       1396     1397       +1     
- Partials      233      234       +1     
Flag Coverage Δ
e2e 49.01% <12.26%> (-1.08%) ⬇️
unit 57.72% <98.11%> (+0.76%) ⬆️

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.

@perdasilva perdasilva force-pushed the bundle-rbac branch 2 times, most recently from 38843e5 to 24b9633 Compare February 14, 2025 12:41
@perdasilva perdasilva marked this pull request as ready for review March 4, 2025 14:40
@perdasilva perdasilva requested a review from a team as a code owner March 4, 2025 14:40
@perdasilva perdasilva changed the title [WIP] ✨ Add installer rbac generator ✨ Add installer policy rule generators Mar 4, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 4, 2025
return slices.Contains(clusterScopedResources, o.GetObjectKind().GroupVersionKind().Kind)
}

func isNamespaceScopedResource(o client.Object) bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since we expect the rendered manifests as input, I'm wondering if we could just check whether .metadata.namespace is set as the discriminant....

@@ -29,6 +29,10 @@ import (
"github.com/operator-framework/operator-controller/internal/operator-controller/rukpak/util"
)

const (
AnnotationRegistryV1GeneratedManifest = "io.operatorframework.olm.generated-manifest"
Copy link
Contributor

@camilamacedo86 camilamacedo86 Mar 5, 2025

Choose a reason for hiding this comment

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

So it is a new annotation.
What happens when we use this new annotation?
Are we allowing the creation of RBAC rules for the Cluster Extension?
Is that? Can you please clarify when it is required and why? (for the POV of the Cluster Extension User)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something we can talk about. This annotation exists only to inform the client of convert.Convert which of the resources where generated by it as opposed to coming directly from the bundle. Other than that, it does nothing. It's really just a signal to say "this resource was generated when rendering the bundle - it is not part of the bundle itself"

Per Goncalves da Silva added 5 commits March 17, 2025 10:46
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Signed-off-by: Per Goncalves da Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants