Skip to content

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Aug 26, 2025

Pass installNamespace and watchNamespace as config values

Description

Reviewer Checklist

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

@anik120 anik120 requested a review from a team as a code owner August 26, 2025 15:34
Copy link

netlify bot commented Aug 26, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 2f22efa
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/68b22df35cadad00082c7c99
😎 Deploy Preview https://deploy-preview-2166--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 grokspawn August 26, 2025 15:34
@anik120 anik120 changed the title ✨ (rukpak) extend bundle renderer to accept config opts ✨ OPRUN-4090: (rukpak) extend bundle renderer to accept config opts Aug 26, 2025
@anik120 anik120 force-pushed the registryv1-renderer-config-support branch 2 times, most recently from 3577b5b to cb7ab21 Compare August 26, 2025 15:44
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 93.87755% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.06%. Comparing base (d95f426) to head (8e2e4bb).

Files with missing lines Patch % Lines
...nternal/operator-controller/rukpak/convert/helm.go 93.87% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2166      +/-   ##
==========================================
+ Coverage   72.71%   73.06%   +0.35%     
==========================================
  Files          79       79              
  Lines        7378     7422      +44     
==========================================
+ Hits         5365     5423      +58     
+ Misses       1666     1649      -17     
- Partials      347      350       +3     
Flag Coverage Δ
e2e 44.14% <48.97%> (-0.01%) ⬇️
experimental-e2e 58.41% <59.18%> (+2.28%) ⬆️
unit 58.40% <93.87%> (+0.22%) ⬆️

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.

@anik120 anik120 force-pushed the registryv1-renderer-config-support branch 3 times, most recently from f26e1fa to 7b919f4 Compare August 26, 2025 19:29
@anik120 anik120 force-pushed the registryv1-renderer-config-support branch 4 times, most recently from 3f1ce78 to 119d1d1 Compare August 27, 2025 15:02
@anik120
Copy link
Contributor Author

anik120 commented Aug 27, 2025

Carrying over a comment from slack to help other reviewers:

okay I pushed a change right now with BundleConfig converted to a discriminated union, PTAL.
And OpenAPI schema generation sounds cleaner. I kept validation in for now, but it makes sense to introduce OpenAPI schema generation and rely on that validation instead of writing custom logic

@anik120 anik120 force-pushed the registryv1-renderer-config-support branch 6 times, most recently from c17dec4 to 83f1974 Compare August 28, 2025 18:56
@anik120 anik120 force-pushed the registryv1-renderer-config-support branch 6 times, most recently from 09a3eee to 392c4a9 Compare August 29, 2025 16:24
Copy link

openshift-ci bot commented Aug 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kevinrizza for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@anik120 anik120 force-pushed the registryv1-renderer-config-support branch from 392c4a9 to 94c7776 Compare August 29, 2025 16:29
Pass installNamespace and watchNamespace as config values
@anik120 anik120 force-pushed the registryv1-renderer-config-support branch from 94c7776 to 2f22efa Compare August 29, 2025 22:47
Comment on lines +226 to +228
bundleConfig := map[string]interface{}{}
bundleConfig[bundle.BundleConfigWatchNamespaceKey] = watchNamespace
bundleConfig[bundle.BundleConfigInstallNamespaceKey] = ext.Spec.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bundleConfig := map[string]interface{}{}
bundleConfig[bundle.BundleConfigWatchNamespaceKey] = watchNamespace
bundleConfig[bundle.BundleConfigInstallNamespaceKey] = ext.Spec.Namespace
bundleConfig := map[string]interface{}{
bundle.BundleConfigInstallNamespaceKey: ext.Spec.Namespace,
bundle.BundleConfigWatchNamespaceKey: watchNamespace,
}

Comment on lines +27 to +29
config := map[string]interface{}{}
config[bundle.BundleConfigInstallNamespaceKey] = "install-namespace"
config[bundle.BundleConfigWatchNamespaceKey] = "watch-namespace"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
config := map[string]interface{}{}
config[bundle.BundleConfigInstallNamespaceKey] = "install-namespace"
config[bundle.BundleConfigWatchNamespaceKey] = "watch-namespace"
config := map[string]interface{}{
bundle.BundleConfigInstallNamespaceKey: "install-namespace",
bundle.BundleConfigWatchNamespaceKey: "watch-namespace",
}

same for the others

@@ -111,7 +124,7 @@ type BundleRenderer struct {
ResourceGenerators []ResourceGenerator
}

func (r BundleRenderer) Render(rv1 bundle.RegistryV1, installNamespace string, opts ...Option) ([]client.Object, error) {
func (r BundleRenderer) Render(rv1 bundle.RegistryV1, opts ...Option) ([]client.Object, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not make install namespace optional here. We will always need an install namespace. So, I'd revert the changes to this package.

rv1, err := bundle.GetBundle()
if err != nil {
return nil, err
}

// Convert config map to render options
var opts []render.Option
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
var opts []render.Option
opts := []render.Option{
render.WithCertificateProvider(r.CertificateProvider),
}

then remove line 37

// Convert config map to render options
var opts []render.Option
if config != nil {
if installNs, ok := config[bundlepkg.BundleConfigInstallNamespaceKey].(string); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should return an error here as installNamespace is mandatory.

if installNs, ok := config[bundlepkg.BundleConfigInstallNamespaceKey].(string); ok {
opts = append(opts, render.WithInstallNamespace(installNs))
}
if watchNs, ok := config[bundlepkg.BundleConfigWatchNamespaceKey].(string); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's bring back deriveDefaults and set watchNamespaces to:

  • corev1.NamespaceAll iff AllNamespaces is supported
  • install-namespace iff the only supported install-mode is OwnNamespace
  • an error is its not set and SingleNamespace is the only supported mode
  • an error if there are no supported install modes

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.

3 participants