Skip to content

Conversation

@perdasilva
Copy link
Contributor

Description

Changes

  • Adds an UnmarshalConfig function to the (registry+v1) bundle package that unmarshals a json/yaml byte slice into a registry+v1 configuration struct and subsequently validates it
  • Refactors the RegistryV1ManifestProvider to use the new function and removes the getWatchNamespace function

For this PR we do manual registry+v1 bundle config schema validation as this is sufficient. Once the configuration surface expands (e.g. by adding SubscriptionConfig support, or others), and/or we add Helm bundle support, we'd probably want to move to a JSONSchema-based approach.

Motivation

As things were, we'd accept bundle configuration containing watchNamespace for any bundle. In keeping with the mental model that each bundle would provide its own configuration schema, this shouldn't be the case. E.g. There are bundles that won't have any configuration like bundles that only support AllNamespaces mode. Therefore, we needed an additional layer of validation that checked the provided configuration against what is provided by the bundle.

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 October 20, 2025 23:05
@openshift-ci openshift-ci bot requested review from dtfranz and joelanford October 20, 2025 23:05
@netlify
Copy link

netlify bot commented Oct 20, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit a5a903c
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/68f78b8b39510200081724cc
😎 Deploy Preview https://deploy-preview-2278--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

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

We are just changing the place where the check lives now to the config API
👍 /lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2025
@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

❌ Patch coverage is 88.46154% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.32%. Comparing base (f125d8b) to head (a5a903c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/operator-controller/rukpak/render/fake.go 0.00% 6 Missing ⚠️
...ternal/operator-controller/rukpak/bundle/config.go 95.31% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2278      +/-   ##
==========================================
+ Coverage   70.28%   70.32%   +0.03%     
==========================================
  Files          88       90       +2     
  Lines        8762     8794      +32     
==========================================
+ Hits         6158     6184      +26     
- Misses       2190     2196       +6     
  Partials      414      414              
Flag Coverage Δ
e2e 44.84% <1.28%> (-0.29%) ⬇️
experimental-e2e 14.10% <0.00%> (-0.06%) ⬇️
unit 58.35% <88.46%> (+0.08%) ⬆️

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.

}

// collect bundle install modes
installModeSet := sets.New(rv1.CSV.Spec.InstallModes...)
Copy link
Contributor

Choose a reason for hiding this comment

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

rv1 is passed into this function only to create this set of install modes. Hence, we can pass to the function these install modes directly, e.g.

func validateConfig(config *Config, rv1 *RegistryV1, installNamespace string, installModes sets.Set[v1alpha1.InstallMode]) error

nit: also, perhaps would be more readable if we implement validateConfig as receiver function on Config:

function (c *Config) ValidateFor(installNamespaces string, installModes sets.Set[v1alpha1.InstallMode]) error

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 the case now. But, not necessarily in the future. We want to validate based on what's in the bundle. At the moment the only pertinent thing is the install mode. I think as an API, taking in the bundle makes more sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think as an API, taking in the bundle makes more sense.

This is a private function, so API can change whenever we see a need.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh sorry - I misread I thought this comment was under the Unmarshal function. I'll fix that up!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But then I wouldn't make it package public though...for the reasons I sited in the first response. I think as an API taking the bundle as a parameter is the right thing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return nil
}

func hasWatchNamespaceAsConfig(bundleInstallModeSet sets.Set[v1alpha1.InstallMode]) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

the function is used once only - thus for the readability it would be ok to put it inline in validate() function. BTW, the function name mentions watchnamespace, but it does not appear in the arguments - perhaps the function name should be rephrased to reflect what it does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The question the function answers is whether the bundle supports the watchNamespace configuration - this is driven off the install mode support. If I don't need it again for the "required" case I'll inline it and add the appropriate comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored to isWatchNamespaceConfigSupported. I prefer to have these more complex clauses aliased under a more understandable function. So, I've left it in.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 21, 2025
@openshift-ci
Copy link

openshift-ci bot commented Oct 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86, thetechnick

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 Oct 21, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 238dcf6 into operator-framework:main Oct 21, 2025
25 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.

4 participants