Skip to content

Conversation

@camilamacedo86
Copy link
Contributor

@camilamacedo86 camilamacedo86 commented Nov 9, 2025

Bundle configuration is now validated using JSON Schema before installation. Configuration errors (typos, missing required fields, type mismatches) are caught immediately with clear error messages instead of failing during deployment.

Motivation

https://issues.redhat.com/browse/OPRUN-4112

Design

Introduced ConfigSchemaProvider interface to abstract schema source from validation logic:

Registry+v1 Bundle → buildSchemaForInstallModes() ──┐
Helm Chart        → Read values.schema.json       ──┤──→ UnmarshalConfig() ──→ bundle.Config
Registry+v2        → (Future) GetConfigSchema()   ──┘         ↑
                                                          JSON Schema
                                                          Validation

Detailed flow:

┌──────────────────┐
│ Registry+v1      │────┐
│ (implements      │    │
│ ConfigSchema-    │    │
│ Provider)        │    │
└──────────────────┘    │
                        │
┌──────────────────┐    │    ┌─────────────────────┐    ┌──────────────────┐
│ Helm Chart       │────┼───→│ UnmarshalConfig()   │───→│  bundle.Config   │
│ (implements      │    │    │                     │    │  {               │
│ ConfigSchema-    │    │    │ 1. Get schema       │    │    WatchNamespace│
│ Provider)        │    │    │ 2. Validate (JSON)  │    │  }               │
└──────────────────┘    │    │ 3. Parse YAML       │    └──────────────────┘
                        │    └─────────────────────┘
┌──────────────────┐    │            ↑
│ Any Bundle Type  │────┘     SAME FOR ALL
└────────────────── ┘

Do I Need to Configure watchNamespace?

Your Bundle Supports Need to Configure watchNamespace?
AllNamespaces only ✅ No - optional
SingleNamespace only ❌ Yes - pick a different namespace
OwnNamespace only ❌ Yes - must be the install namespace
AllNamespaces + OwnNamespace ✅ No - optional
OwnNamespace + SingleNamespace ❌ Yes - pick a namespace

Examples

✅ Works: No config needed

kind: ClusterExtension
spec:
  packageName: my-operator
  # No config - works if bundle supports AllNamespaces

✅ Works: With config

kind: ClusterExtension
spec:
  packageName: my-operator
  config:
    watchNamespace: my-namespace

❌ Fails: Missing required field

kind: ClusterExtension
spec:
  packageName: my-operator
  # Error: required field "watchNamespace" is missing

❌ Fails: Typo in field name

kind: ClusterExtension
spec:
  packageName: my-operator
  config:
    watchNamespce: my-namespace  # Typo!
    # Error: unknown field "watchNamespce"

❌ Fails: Wrong namespace

kind: ClusterExtension
metadata:
  namespace: my-namespace
spec:
  packageName: my-operator
  config:
    watchNamespace: wrong-namespace
    # Error: must be install namespace (my-namespace)

@camilamacedo86 camilamacedo86 requested a review from a team as a code owner November 9, 2025 09:32
@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 Nov 9, 2025
@netlify
Copy link

netlify bot commented Nov 9, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit b828f0b
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/69148367af00e1000838aa93
😎 Deploy Preview https://deploy-preview-2316--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.

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

❌ Patch coverage is 76.38889% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.42%. Comparing base (d204888) to head (b828f0b).

Files with missing lines Patch % Lines
...ternal/operator-controller/rukpak/bundle/config.go 75.94% 33 Missing and 18 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2316    +/-   ##
========================================
  Coverage   74.42%   74.42%            
========================================
  Files          91       92     +1     
  Lines        7057     7233   +176     
========================================
+ Hits         5252     5383   +131     
- Misses       1393     1422    +29     
- Partials      412      428    +16     
Flag Coverage Δ
e2e 44.68% <0.00%> (-1.19%) ⬇️
experimental-e2e 48.57% <50.92%> (+0.11%) ⬆️
unit 58.81% <75.92%> (+0.30%) ⬆️

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.

@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 3 times, most recently from a753a5c to f15ea9f Compare November 9, 2025 10:35
@camilamacedo86 camilamacedo86 changed the title WIP: ✨ (chore): Add structured bundle config validation helpers and tests. ✨ (chore): Add structured bundle config validation helpers and tests. Nov 9, 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 Nov 9, 2025
@openshift-ci
Copy link

openshift-ci bot commented Nov 9, 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 joelanford 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

@camilamacedo86 camilamacedo86 changed the title ✨ (chore): Add structured bundle config validation helpers and tests. ✨ (chore): Bundle configuration is now validated - errors caught early with clear messages. Nov 9, 2025
@camilamacedo86 camilamacedo86 changed the title ✨ (chore): Bundle configuration is now validated - errors caught early with clear messages. ✨ Bundle configuration is now validated - errors caught early with clear messages. Nov 9, 2025
Copilot AI review requested due to automatic review settings November 10, 2025 10:13
@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 2 times, most recently from 1f3451a to 65bd4ef Compare November 10, 2025 10:17

This comment was marked as outdated.

@camilamacedo86 camilamacedo86 force-pushed the add-checks-config branch 2 times, most recently from d78bf4a to 920f78e Compare November 10, 2025 11:08

This comment was marked as outdated.

This comment was marked as outdated.

@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 Nov 11, 2025
Copilot finished reviewing on behalf of camilamacedo86 November 11, 2025 13:56

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings November 11, 2025 14:11
Copilot finished reviewing on behalf of camilamacedo86 November 11, 2025 14:15

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings November 11, 2025 16:34
Copilot finished reviewing on behalf of camilamacedo86 November 11, 2025 16:35
Copy link

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 6 out of 6 changed files in this pull request and generated no new comments.


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

@camilamacedo86 camilamacedo86 changed the title WIP: ✨ Bundle configuration is now validated - errors caught early with clear messages. ✨ Add Bundle-Agnostic Configuration Validation Using JSON Schema Nov 12, 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 Nov 12, 2025
Bundle configuration is now validated using JSONSchema. Configuration
errors (typos, missing required fields, wrong types) are caught
immediately with clear error messages instead of failing during installation.

Assisted-by: Cursor
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.

1 participant