Skip to content

OPRUN-4599: override catalog image tag when Helm values pin v5.0#203

Open
tmshort wants to merge 1 commit intoopenshift:mainfrom
tmshort:oprun-4599
Open

OPRUN-4599: override catalog image tag when Helm values pin v5.0#203
tmshort wants to merge 1 commit intoopenshift:mainfrom
tmshort:oprun-4599

Conversation

@tmshort
Copy link
Copy Markdown
Contributor

@tmshort tmshort commented May 5, 2026

OCP 4.23 and 5.0 are co-released from the same branch, so the catalogd
openshift.yaml Helm values file statically pins options.openshift.catalogs.version
to "v5.0". A cluster actually running 4.23 must reference v4.23 catalog index
images instead.

Compute the catalog image tag from RELEASE_VERSION at startup and, only when
options.openshift.catalogs.version equals "v5.0", override it with the tag
derived from the running cluster's OCP major.minor version. The conditional
guard keeps CI tests against other OCP versions unaffected (their published
catalog images exist under the tag shipped in the Helm values file).

A TODO marks the override block for removal once 4.23/5.0 are no longer
co-released and the values file no longer pins "v5.0".

Summary by CodeRabbit

  • New Features

    • Operator reads its image/version once and derives a catalog image tag from the cluster OCP minor version.
    • Helm rendering can be conditionally overridden to use the computed catalog tag when applicable; Helm values can now be inspected for dot-delimited keys.
  • Tests

    • Added unit tests validating catalog image tag formatting (vMAJOR.MINOR) and the Helm override/values behavior.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 5, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 5, 2026

@tmshort: This pull request references OPRUN-4599 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

The openshift.yaml Helm values file for catalogd has a static catalog image tag (e.g. v4.22) under options.openshift.catalogs.version. With OCP 4.23 and 5.0 co-released from the same branch, this static tag cannot correctly serve both cluster variants.

Compute the catalog image tag from RELEASE_VERSION at startup and override options.openshift.catalogs.version in the Helm values before rendering, so the ClusterCatalog manifests always reference the catalog index image matching the running cluster's OCP major.minor version.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Walkthrough

Compute a catalog image tag from the operator image version, expose it on the controller Builder, conditionally inject it into rendered Helm values, and add helper + tests to format and read catalog tags as v<major>.<minor>.

Changes

Catalog Image Tag wiring

Layer / File(s) Summary
Data Shape / Helpers
internal/versionutils/version_utils.go, internal/versionutils/version_utils_test.go
Added GetCatalogImageTag(version *semver.Version) string returning v<Major>.<Minor>; tests cover 4.22, 4.23, 5.0, 5.1 and patch-ignored case.
Values accessor
pkg/helmvalues/helmvalues.go, pkg/helmvalues/helmvalues_test.go
Added HelmValues.GetStringValue(location string) (string, bool) with unit tests for missing, direct, nested, and non-string cases.
Operator init / data extraction
cmd/cluster-olm-operator/main.go
Read operatorImageVersion from env once, compute currentOCPMinorVersion and catalogImageTag via helpers, and pass catalogImageTag into the Builder; use the computed operator version when configuring VersionGetter.
Builder surface
pkg/controller/builder.go
Exported Builder gains ClusterCatalogImageTag string to carry the computed tag through controller initialization.
Helm integration / wiring
pkg/controller/helm.go
renderHelmTemplate calls applyCatalogImageTagOverride(values, b.ClusterCatalogImageTag) which conditionally replaces options.openshift.catalogs.version when clusterTag is non-empty and the existing pinned value equals "v5.0"; errors are wrapped.
Tests for wiring
pkg/controller/helm_test.go
Added TestApplyCatalogImageTagOverride validating override/no-op behavior across scenarios (empty cluster tag, pinned v5.0, non-matching value, missing key).

Sequence Diagram

sequenceDiagram
    participant Main as cmd/cluster-olm-operator/main.go
    participant VersionUtils as internal/versionutils
    participant Builder as pkg/controller/builder.go
    participant HelmValues as pkg/helmvalues
    participant Helm as pkg/controller/helm.go

    Main->>VersionUtils: GetCurrentOCPMinorVersion(operatorImageVersion)
    VersionUtils-->>Main: semver.Version
    Main->>VersionUtils: GetCatalogImageTag(version)
    VersionUtils-->>Main: "v<major>.<minor>"
    Main->>Builder: Instantiate Builder with ClusterCatalogImageTag
    Builder->>Helm: renderHelmTemplate()
    Helm->>HelmValues: GetStringValue("options.openshift.catalogs.version")
    alt ClusterCatalogImageTag non-empty and current == "v5.0"
        Helm->>HelmValues: set options.openshift.catalogs.version = ClusterCatalogImageTag
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ❓ Inconclusive Custom check requests Ginkgo test review, but this PR uses standard Go tests (testing.T). No Ginkgo tests exist in the repository. Check is inapplicable: designed for Ginkgo BDD tests, not standard Go tests. Note: TestApplyCatalogImageTagOverride line 141 has bug flagged in review comments.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: computing a catalog image tag from cluster version and overriding the Helm-pinned v5.0 value, directly matching the changeset's core functionality.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR contains only standard Go tests using testing.T, not Ginkgo tests. Custom check applies to Ginkgo test names only. All test names are static and deterministic.
Microshift Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. All new tests are standard Go unit tests using the testing package. The MicroShift compatibility check only applies to new Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. All new tests are standard Go unit tests for utility and controller helper functions. SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed No scheduling constraints introduced. Changes only affect Helm catalog image versioning, not deployment topology or affinity rules.
Ote Binary Stdout Contract ✅ Passed No process-level stdout violations. New code avoids stdout writes. GetCatalogImageTag uses fmt.Sprintf (returns string, not stdout). No klog to stdout issues introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added. All new tests are standard Go unit tests using testing.T, not Ginkgo patterns. Custom check applies only to e2e tests, so not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from grokspawn and perdasilva May 5, 2026 17:48
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 5, 2026
@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 5, 2026

/hold
Until all catalogs are available with the correct version.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 5, 2026
@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 6, 2026

/unhold
New method is being used.

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 6, 2026
@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 6, 2026

/test openshift-e2e-aws-customnoupgrade
This is also failing in #202, so I may override if it continues to fail.

@tmshort tmshort changed the title OPRUN-4599: load ClusterCatalog default catalogs of matching cluster version OPRUN-4599: override catalog image tag when Helm values pin v5.0 May 6, 2026
@joelanford
Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2026
@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 6, 2026

I tested this via cluster-bot:

launch 4.23,openshift/operator-framework-operator-controller#715,openshift/cluster-olm-operator#203 aws

and although the OLM containers had v5.0 for the catalogs (openshift/operator-framework-operator-controller#715), the catalogs contained v4.23, so it was successfully chnaged.

@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 6, 2026

/test openshift-e2e-aws-customnoupgrade
/test openshift-e2e-aws

@dtfranz
Copy link
Copy Markdown
Contributor

dtfranz commented May 7, 2026

/test openshift-e2e-aws-customnoupgrade

@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 7, 2026

/override ci/prow/openshift-e2e-aws-customnoupgrade
It last succeeded a month ago.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

@tmshort: Overrode contexts on behalf of tmshort: ci/prow/openshift-e2e-aws-customnoupgrade

Details

In response to this:

/override ci/prow/openshift-e2e-aws-customnoupgrade
It last succeeded a month ago.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

OCP 4.23 and 5.0 are co-released from the same branch, causing
openshift.yaml to pin options.openshift.catalogs.version to "v5.0".
Override the tag from RELEASE_VERSION when it equals "v5.0" so 4.23
clusters use v4.23 catalog images; all other versions are unaffected.

Assisted-by: claude
Signed-off-by: Todd Short <tshort@redhat.com>
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label May 8, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controller/helm_test.go`:
- Around line 141-143: The test currently only asserts the returned value from
hv.GetStringValue (assigned to got) against tt.expectedTag and ignores the
presence flag; update the test to also check the found boolean from
hv.GetStringValue: call hv.GetStringValue(versionKey) capturing (got, found),
and for cases where tt.expectedTag is empty assert that found is false,
otherwise assert found is true and then assert got equals tt.expectedTag;
reference hv.GetStringValue, the got/found return values, and tt.expectedTag in
your changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a95c85eb-b4a9-4aad-9f37-4068d35c233c

📥 Commits

Reviewing files that changed from the base of the PR and between 79ee834 and 0c20c10.

📒 Files selected for processing (8)
  • cmd/cluster-olm-operator/main.go
  • internal/versionutils/version_utils.go
  • internal/versionutils/version_utils_test.go
  • pkg/controller/builder.go
  • pkg/controller/helm.go
  • pkg/controller/helm_test.go
  • pkg/helmvalues/helmvalues.go
  • pkg/helmvalues/helmvalues_test.go
✅ Files skipped from review due to trivial changes (1)
  • internal/versionutils/version_utils.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • pkg/controller/builder.go
  • pkg/controller/helm.go
  • pkg/helmvalues/helmvalues.go
  • internal/versionutils/version_utils_test.go
  • cmd/cluster-olm-operator/main.go

Comment on lines +141 to +143
got, _ := hv.GetStringValue(versionKey)
require.Equal(t, tt.expectedTag, got)
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Assert key presence, not just value, for “absent key” cases.

Line 141 ignores the found flag, but your table comment says empty expectedTag means the key is absent. A key set to "" would incorrectly pass today.

Suggested fix
-			got, _ := hv.GetStringValue(versionKey)
-			require.Equal(t, tt.expectedTag, got)
+			got, found := hv.GetStringValue(versionKey)
+			if tt.expectedTag == "" {
+				require.False(t, found, "expected %s to be absent", versionKey)
+				require.Empty(t, got)
+				return
+			}
+			require.True(t, found, "expected %s to be present", versionKey)
+			require.Equal(t, tt.expectedTag, got)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
got, _ := hv.GetStringValue(versionKey)
require.Equal(t, tt.expectedTag, got)
})
got, found := hv.GetStringValue(versionKey)
if tt.expectedTag == "" {
require.False(t, found, "expected %s to be absent", versionKey)
require.Empty(t, got)
return
}
require.True(t, found, "expected %s to be present", versionKey)
require.Equal(t, tt.expectedTag, got)
})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controller/helm_test.go` around lines 141 - 143, The test currently only
asserts the returned value from hv.GetStringValue (assigned to got) against
tt.expectedTag and ignores the presence flag; update the test to also check the
found boolean from hv.GetStringValue: call hv.GetStringValue(versionKey)
capturing (got, found), and for cases where tt.expectedTag is empty assert that
found is false, otherwise assert found is true and then assert got equals
tt.expectedTag; reference hv.GetStringValue, the got/found return values, and
tt.expectedTag in your changes.

Copy link
Copy Markdown

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 2026
@tmshort
Copy link
Copy Markdown
Contributor Author

tmshort commented May 8, 2026

/test openshift-e2e-aws-devpreview
/test openshift-e2e-aws-customnoupgrade

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

@tmshort: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/openshift-e2e-aws-customnoupgrade 0c20c10 link true /test openshift-e2e-aws-customnoupgrade
ci/prow/openshift-e2e-aws-devpreview 0c20c10 link true /test openshift-e2e-aws-devpreview

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants