Skip to content

🌱 In-tree test operator #2070

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

perdasilva
Copy link
Contributor

Description

Adds the scaffolding for the test-operator in versions v1 and v2 using operator-sdk. The test-operator is a basic echo service.

The test-operator supports AllNamespaces, SingleNamespace, and OwnNamespace install modes.
v1 has validating and mutating webhooks
v2 has validating, mutating and conversion webhooks

TODO

  • test/test-operator/Makefile: tie in the building of the controllers, bundles, and catalog
  • test/test-operator/test-operator-catalog.json: test-operator package catalog
  • either remove validating and mutating webhooks for v1, or from v2 to reduce complexity (don't need them in both)

Thing we should feel confident in doing in the future

  • Producing different kinds of bundles: helm, registry+v2, etc.
  • Adding more bundles (though we probably want to keep the general number low)

Risks

  • Dependency (CRD) between v1 and v2, i.e. cha

v1

A reconciled test-operator v1 resource would look like this:

apiVersion: testolm.operator-framework.io/v1
kind: TestOperator
metadata:
  name: test-operator
spec:
  message: "hello"
status:
  echo: "hello"

The v1 operator also includes a validating and mutating webhook. The validating webhook validates .spec.message against a keyword and rejects admission if its found. The mutating webhook is used as a "defaulting" webhook that sets .spec.message to the default message of Echo.

v2

A reconciled test-operator v2 resource would look like this:

apiVersion: testolm.operator-framework.io/v2
kind: TestOperator
metadata:
  name: test-operator
spec:
  echoMessage: "hello"
status:
  echo: "hello"

The same webhooks are available for v2 apis + a conversion webhook to support the CRD upgrade.

Reviewer Checklist

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

Per Goncalves da Silva added 2 commits July 3, 2025 17:21
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
@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 Jul 3, 2025
Copy link

openshift-ci bot commented Jul 3, 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 perdasilva 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

Copy link

netlify bot commented Jul 3, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit 665d459
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6866aad54979a40008afe627
😎 Deploy Preview https://deploy-preview-2070--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

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.31%. Comparing base (22a990c) to head (665d459).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2070      +/-   ##
==========================================
- Coverage   74.66%   73.31%   -1.36%     
==========================================
  Files          81       77       -4     
  Lines        7365     7056     -309     
==========================================
- Hits         5499     5173     -326     
- Misses       1528     1542      +14     
- Partials      338      341       +3     
Flag Coverage Δ
e2e 44.98% <ø> (+0.92%) ⬆️
experimental-e2e 51.25% <ø> (+1.16%) ⬆️
unit 58.27% <ø> (-1.97%) ⬇️

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 changed the title In-tree test operator 🌱 In-tree test operator Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant