Skip to content

Conversation

perdasilva
Copy link
Contributor

@perdasilva perdasilva commented Jul 15, 2025

Description

Once we introduce experimental API types and controllers the standard rbac will get polluted.
This PR:

Updates the Makefile to generate standard and experimental rbac
Updates kustomize to handle this split
Update hack/tools/upgrade-crds.sh to be tolerant to ungenerated files. This may happen if there are new types that are not registered in the the standardKinds map in hack/tools/crd-generator/main.go

Experimental controllers should carry //go:build !standard build tag. This will exclude it from the standard manifest generation step in the Makefile.

Reviewer Checklist

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

@perdasilva perdasilva requested a review from a team as a code owner July 15, 2025 16:00
Copy link

netlify bot commented Jul 15, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 279fcc9
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6877b0ec5647fe000808fe33
😎 Deploy Preview https://deploy-preview-2099--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.

@openshift-ci openshift-ci bot requested review from bentito and oceanc80 July 15, 2025 16:00
@tmshort
Copy link
Contributor

tmshort commented Jul 15, 2025

I think this is a good start, but we should also do this for catalogd...

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.48%. Comparing base (b25356d) to head (279fcc9).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2099   +/-   ##
=======================================
  Coverage   73.48%   73.48%           
=======================================
  Files          78       78           
  Lines        7240     7240           
=======================================
  Hits         5320     5320           
  Misses       1568     1568           
  Partials      352      352           
Flag Coverage Δ
e2e 43.85% <ø> (ø)
experimental-e2e 50.05% <ø> (ø)
unit 58.75% <ø> (ø)

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
Copy link
Contributor Author

perdasilva commented Jul 15, 2025

I think this is a good start, but we should also do this for catalogd...

@tmshort I've added it. But are you sure we aren't jumping the gun a little. I wonder if we'll ever add new APIs or controllers to catalogd...:thinking:

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this file added? I don't see a reference to it anywhere? It seems like an old file that was deleted a while go?

Copy link
Contributor Author

@perdasilva perdasilva Jul 16, 2025

Choose a reason for hiding this comment

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

I messed up. Great catch, thank you!

@tmshort
Copy link
Contributor

tmshort commented Jul 15, 2025

Experimental controllers should carry //go:build !standard build tag. This will exclude it from the standard manifest generation step in the Makefile.

This statement doesn't apply. We do not build separately for standard vs experimental; it's the same code, just different manifests. (We literally use the same build image.) This means that any new CRDs will have to be provided regardless of standard v. experimental, even if they only define an empty Spec and Status for their standard definition.

EDIT: To clarify, experimental controllers should be included/excluded based on feature gate flags, not build flags. The manifests (including CRDs) can change at any time during a deployment (including argument flags).

EDIT 2: However, i think what's not clear (to me, at least initially) is that this tag is only used for generating the RBAC, and is not used during code compilation. I will likely need to update the RFCs to make the use of //go:build !standard clear. We may want to consider the adding the term "rbac" to this tag to make the use even more clear, and possibly do the same for webhooks in the future. Regardless, my confusion over the use of the build tag needs to be resolved via documentation or similar, because it will confuse someone else!

@tmshort
Copy link
Contributor

tmshort commented Jul 15, 2025

@grokspawn believes we might, and I would prefer a complete solution.

It's a good sign that the committed manifests did not change!

This looks good, but I don't know why config/webhook/manifests.yaml was added.

@perdasilva perdasilva force-pushed the exp-gen-updates branch 2 times, most recently from 6f12fcb to 4c3456a Compare July 16, 2025 11:11
@perdasilva
Copy link
Contributor Author

perdasilva commented Jul 16, 2025

Experimental controllers should carry //go:build !standard build tag. This will exclude it from the standard manifest generation step in the Makefile.

This statement doesn't apply. We do not build separately for standard vs experimental; it's the same code, just different manifests. (We literally use the same build image.) This means that any new CRDs will have to be provided regardless of standard v. experimental, even if they only define an empty Spec and Status for their standard definition.

EDIT: To clarify, experimental controllers should be included/excluded based on feature gate flags, not build flags. The manifests (including CRDs) can change at any time during a deployment (including argument flags).

EDIT 2: However, i think what's not clear (to me, at least initially) is that this tag is only used for generating the RBAC, and is not used during code compilation. I will likely need to update the RFCs to make the use of //go:build !standard clear. We may want to consider the adding the term "rbac" to this tag to make the use even more clear, and possibly do the same for webhooks in the future. Regardless, my confusion over the use of the build tag needs to be resolved via documentation or similar, because it will confuse someone else!

@tmshort
The binaries should be built including everything (and we do the branching via feature gates as you mentioned in a previous comment). The !standard artifice is strictly to remove experimental rbac from the standard manifests. So, I think we're aligned on that =D

I think we can get away with not generating new and experimental CRDs by not adding them to the standardKinds map but still adding them to the generate-crds.sh lists of things to generate. I would highly encourage us to use this path (unless there's something I'm not seeing) because it feels a bit weird to ship empty CRDs to production. I've done this in the Boxcutter WIP PR if you want to have a look to see what that looks like in code.

I've put an additional commit to add exp/std split support for the catalogd webhooks. Feels like it leads to a lot of duplication (and I'd also pose the same question of whether we have any inclination to have experimental webhooks, etc.).

Regarding catalogd, I think the solution is complete without this additional complexity under the assumption there will be no new controllers and we'll just have experimental changes to the existing CRD and add features to the existing controllers. I get that there's a certain lack of symmetry, but I think we'd be carrying around additional complexity for no added benefit, or just in case future us decide to violate the stated assumption - and it should be easy enough to add the split when the time comes anyway. But, I'll defer to your better judgement here since you've put all of this together.

@tmshort
Copy link
Contributor

tmshort commented Jul 16, 2025

@tmshort
The binaries should be built including everything (and we do the branching via feature gates as you mentioned in a previous comment). The !standard artifice is strictly to remove experimental rbac from the standard manifests. So, I think we're aligned on that =D

Exactly.

I think we can get away with not generating new and experimental CRDs by not adding them to the standardKinds map but still adding them to the generate-crds.sh lists of things to generate. I would highly encourage us to use this path (unless there's something I'm not seeing) because it feels a bit weird to ship empty CRDs to production. I've done this in the Boxcutter WIP PR if you want to have a look to see what that looks like in code.

Yes, that is the purpose of those lists in the generator.

I've put an additional commit to add exp/std split support for the catalogd webhooks. Feels like it leads to a lot of duplication (and I'd also pose the same question of whether we have any inclination to have experimental webhooks, etc.).

I hear you about duplication. However, we still need to keep the manifest generation separate for downstream reasons. So, we unfortunately have to deal with it. Also, there are kubebuilder limitations on the number of paths it can accept in a single invocation (it's only one path).

Regarding catalogd, I think the solution is complete without this additional complexity under the assumption there will be no new controllers and we'll just have experimental changes to the existing CRD and add features to the existing controllers. I get that there's a certain lack of symmetry, but I think we'd be carrying around additional complexity for no added benefit, or just in case future us decide to violate the stated assumption - and it should be easy enough to add the split when the time comes anyway. But, I'll defer to your better judgement here since you've put all of this together.

I would prefer to have it in place for catalogd, because when the time comes around, and something is added to catalogd, and the experimental/standard split is only partially done (i.e. for CRDs but not RBAC), it going to really confuse someone, and they are going to have to recreate this infrastructure.

You have done the work for this, so thank you!

@tmshort tmshort changed the title 🌱 Split rbac generation into experimental/standard 🌱 OPRUN-4016: Split rbac generation into experimental/standard Jul 16, 2025
Per Goncalves da Silva added 4 commits July 16, 2025 15:59
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
@perdasilva
Copy link
Contributor Author

perdasilva commented Jul 16, 2025

@tmshort
No worries. If you're good with the way it is, then let's proceed =D

@tmshort
Copy link
Contributor

tmshort commented Jul 16, 2025

/approve

Copy link

openshift-ci bot commented Jul 16, 2025

[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

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 Jul 16, 2025
@tmshort
Copy link
Contributor

tmshort commented Jul 16, 2025

This does not appear to have any downstream issues...
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 7c12644 into operator-framework:main Jul 16, 2025
22 checks passed
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants