Skip to content

🌱 OPRUN-4122 Drop hash computation of ClusterExtensionRevision phases - #2245

Merged
openshift-merge-bot[bot] merged 2 commits into
operator-framework:mainfrom
pedjak:remove-hash-usage
Oct 13, 2025
Merged

🌱 OPRUN-4122 Drop hash computation of ClusterExtensionRevision phases #2245
openshift-merge-bot[bot] merged 2 commits into
operator-framework:mainfrom
pedjak:remove-hash-usage

Conversation

@pedjak

@pedjakpedjak commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

Description

Applier can decide if a new ClusterExtensionRevision needs to be created
without computing the digest all objects in phases:

  • try to patch the current revision
  • if the operation fails due to invalid payload, it is a signal that we tried
    to update an immutable field (phases included)
  • in that case, create a new revision

Benefits:

  • No need to keep the computed digest attached to ClusterExtensionRevision as annotation
  • Revisions are created using SSA, passing the right field owner
  • Simpler applier logic

Changes:

  • Unit tests updated, rephrasing their names to better reflect the use case scenario under test
  • Added test-operator 1.2.0 bundle to be able to assert creation of new revision in added e2e TestClusterExtensionForceInstallNonSuccessorVersion test
  • Helper function previously living in test/e2e/cluster_extension_install_test.go extracted into test/helpers/helpers.go so that it could be used in
    test/experimental-e2e/experimental_e2e_test.go as well

Reviewer Checklist

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

@openshift-ciopenshift-ciBot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 2, 2025
@netlify

netlifyBot commented Oct 2, 2025

Copy link
Copy Markdown

Deploy Preview for olmv1 ready!

NameLink
🔨 Latest commit9e94fd2
🔍 Latest deploy loghttps://app.netlify.com/projects/olmv1/deploys/68ece06b87c63c0008e59fac
😎 Deploy Previewhttps://deploy-preview-2245--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

codecovBot commented Oct 2, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.91%. Comparing base (687401c) to head (9e94fd2).
⚠️ Report is 1 commits behind head on main.

Files with missing linesPatch %Lines
internal/operator-controller/applier/boxcutter.go72.97%6 Missing and 4 partials ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #2245 +/- ##
==========================================
+ Coverage 69.94% 72.91% +2.96% 
==========================================
Files 88 88 Lines 8733 8738 +5 ==========================================
+ Hits 6108 6371 +263 + Misses 2205 1953 -252 + Partials 420 414 -6 
FlagCoverage Δ
e2e39.40% <0.00%> (+0.11%)⬆️
experimental-e2e46.67% <75.00%> (?)
unit58.01% <67.50%> (+0.01%)⬆️

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.

@pedjakpedjak changed the title wip remove phase hashing at CER applier✨ Drop hash computation of ClusterExtensionRevision phases Oct 6, 2025
@pedjak
pedjak marked this pull request as ready for review October 6, 2025 22:51
@pedjak
pedjak requested a review from a team as a code ownerOctober 6, 2025 22:51
@openshift-ciopenshift-ciBot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 6, 2025
@pedjak
pedjak requested a review from perdasilvaOctober 6, 2025 22:52
Comment threadinternal/operator-controller/applier/boxcutter.go Outdated
Comment threadinternal/operator-controller/applier/boxcutter.go Outdated
Comment threadcmd/operator-controller/main.go
t.Log("By updating the ClusterExtension resource to a non-successor version")
// 1.2.0 does not replace/skip/skipRange 1.0.0.
clusterExtension.Spec.Source.Catalog.Version = "1.2.0"
clusterExtension.Spec.Source.Catalog.UpgradeConstraintPolicy = ocv1.UpgradeConstraintPolicySelfCertified

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
clusterExtension.Spec.Source.Catalog.UpgradeConstraintPolicy=ocv1.UpgradeConstraintPolicySelfCertified
t.Log("By setting the upgrade constraint policy to self-certified")
clusterExtension.Spec.Source.Catalog.UpgradeConstraintPolicy=ocv1.UpgradeConstraintPolicySelfCertified

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I would say it should probably be then By forcing updating the ClusterExtension resource to a non-successor version - setting to self-certified policy is just the way to force such updates. wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Even better ^^

}, pollDuration, pollInterval)
}

func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to have a negative test as well by either having a separate test where we don't update the upgrade policy, or having this test first try with the standard policy, watch it fail, then update to self-certified and watch it succeed?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

The test is not about changing the upgrade policy - is is about asserting that a new revision is created if objects in the new version are different from the previous installed version. Such test did not exist previously.

The additional tests are not bound to the experimental e2e suite and could be added in a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From the title and behavior it seems to be about ensuring that the user can force install to a version without an upgrade edge from the current one (which of course implies the creation of a new revision). Maybe a new title?

Comment threadinternal/operator-controller/applier/boxcutter_test.go
@pedjakpedjak changed the title ✨ Drop hash computation of ClusterExtensionRevision phases 🌱 Drop hash computation of ClusterExtensionRevision phases Oct 10, 2025

@perdasilvaperdasilva left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome! Thank you!!

@openshift-ciopenshift-ciBot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 13, 2025
Applier can decide if a new `ClusterExtensionRevision` needs to be created
without computing the digest all objects in phases:
* try to patch the current revision
* if the operation fails due to invalid payload, it is a signal that we tried
to update an immutable field (phases included)
* in that case, create a new revision
Benefits:
* No need to keep the computed digest attached to `ClusterExtensionRevision` as annotation
* Revisions are created using SSA, passing the right field owner
* Simpler applier logic
Changes:
* Unit tests updated, rephrasing their names to better reflect the use case scenario under test
* Added test-operator 1.2.0 bundle to be able to assert creation of new revision in added e2e `TestClusterExtensionForceInstallNonSuccessorVersion` test
* Helper function previously living in `test/e2e/cluster_extension_install_test.go` extracted into `test/helpers/helpers.go` so that it could be used in
`test/experimental-e2e/experimental_e2e_test.go` as well
@openshift-ciopenshift-ciBot removed the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2025
@openshift-ciopenshift-ciBot added the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2025
@openshift-ci

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: perdasilva

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@pedjakpedjak changed the title 🌱 Drop hash computation of ClusterExtensionRevision phases 🌱 OPRUN-4122 Drop hash computation of ClusterExtensionRevision phases Oct 13, 2025
@openshift-merge-bot
openshift-merge-botBot merged commit 94f2e67 into operator-framework:mainOct 13, 2025
26 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by an approver from all required OWNERS files.lgtmIndicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@pedjak@perdasilva@camilamacedo86