Skip to content

OCPBUGS-77146: Remove status field from CatalogSource, ClusterCatalog…#1369

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
dorzel:OCPBUGS-77146
Mar 25, 2026
Merged

OCPBUGS-77146: Remove status field from CatalogSource, ClusterCatalog…#1369
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
dorzel:OCPBUGS-77146

Conversation

@dorzel
Copy link
Copy Markdown
Member

@dorzel dorzel commented Mar 10, 2026

…, and UpdateService yaml files

Description

This removes the unneeded status field from generated CatalogSource, ClusterCatalog, and UpdateService yaml files. Similar fix to #1311.

Github / Jira issue: https://issues.redhat.com/browse/OCPBUGS-77146

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Ran the m2d and d2m workflow described in the bug, with the ISC provided in the bug. Verified that that status field was gone on the generated CatalogSource, ClusterCatalog, and UpdateService files in the mirror working dir.

Expected Outcome

Status field no longer exists on the files in question.

Summary by CodeRabbit

  • Bug Fixes

    • Generated YAML manifests for CatalogSource, ClusterCatalog, and UpdateService now omit status fields, producing cleaner, production-ready configurations.
  • Tests

    • Added verification tests that assert status fields are absent from all generated manifest outputs and improved test messages for clearer failure context.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 10, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-77146, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

…, and UpdateService yaml files

Description

This removes the unneeded status field from generated CatalogSource, ClusterCatalog, and UpdateService yaml files. Similar fix to #1311.

Github / Jira issue: https://issues.redhat.com/browse/OCPBUGS-77146

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Ran the m2d and d2m workflow described in the bug, with the ISC provided in the bug. Verified that that status field was gone on the generated CatalogSource, ClusterCatalog, and UpdateService files in the mirror working dir.

Expected Outcome

Status field no longer exists on the files in question.

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 Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: ba339490-7f4c-4054-8962-3f1b08e1fae6

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6019c and 6bcfb7e.

📒 Files selected for processing (2)
  • internal/pkg/clusterresources/clusterresources.go
  • internal/pkg/clusterresources/clusterresources_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/pkg/clusterresources/clusterresources_test.go
  • internal/pkg/clusterresources/clusterresources.go

Walkthrough

Removes the top-level status field from generated/unstructured YAML for CatalogSource, ClusterCatalog, and UpdateService during serialization and adds tests that assert generated YAML files contain no status field.

Changes

Cohort / File(s) Summary
Implementation
internal/pkg/clusterresources/clusterresources.go
Delete top-level status from unstructured objects for CatalogSource, ClusterCatalog, and UpdateService before marshalling; continue removal of creationTimestamp where applicable.
Tests
internal/pkg/clusterresources/clusterresources_test.go
Add runtime assertions (verifyNoStatusField) and enhanced parse messages to ensure generated YAML outputs for CatalogSource, ClusterCatalog, and UpdateService do not include a status field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: removing status field from three resource types (CatalogSource, ClusterCatalog, UpdateService).
Stable And Deterministic Test Names ✅ Passed The test suite uses standard Go testing with t.Run and static string literals for all subtest names, with no dynamic values in titles.
Test Structure And Quality ✅ Passed PR contains standard Go tests, not Ginkgo tests. Check is not applicable to this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Error: can't load config: can't unmarshal config by viper (flags, file): 1 error(s) decoding:

  • 'output.formats' expected a map, got 'slice'
    The command is terminated due to an error: can't load config: can't unmarshal config by viper (flags, file): 1 error(s) decoding:

  • 'output.formats' expected a map, got 'slice'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented Mar 10, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 10, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-77146, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @nidangavali

Details

In response to this:

/jira refresh

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.

@openshift-ci openshift-ci Bot requested review from aguidirh, nidangavali and r4f4 March 10, 2026 20:41
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-77146, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @nidangavali

Details

In response to this:

…, and UpdateService yaml files

Description

This removes the unneeded status field from generated CatalogSource, ClusterCatalog, and UpdateService yaml files. Similar fix to #1311.

Github / Jira issue: https://issues.redhat.com/browse/OCPBUGS-77146

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Ran the m2d and d2m workflow described in the bug, with the ISC provided in the bug. Verified that that status field was gone on the generated CatalogSource, ClusterCatalog, and UpdateService files in the mirror working dir.

Expected Outcome

Status field no longer exists on the files in question.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

  • Generated YAML manifests for CatalogSource, ClusterCatalog, and UpdateService now exclude status fields, producing cleaner and production-ready configurations that reduce unnecessary information.

  • Tests

  • Added verification tests to ensure status fields are consistently absent from all generated manifest outputs across all generators.

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.

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.

🧹 Nitpick comments (2)
internal/pkg/clusterresources/clusterresources.go (1)

639-646: Prefer structural sanitization for UpdateService too.

This replacement is tied to the current YAML emitter output and only removes the empty-object form. If UpdateServiceStatus ever stops serializing as exactly status: {}, the field will leak back into the generated manifest. Using the same unstructured-delete flow as the other generators would make this path much harder to regress.

♻️ Suggested direction
-	// put UpdateService in yaml
-	osusBytes, err := yaml.Marshal(osus)
+	unstructuredObj := unstructured.Unstructured{}
+	unstructuredObj.Object, err = runtime.DefaultUnstructuredConverter.ToUnstructured(&osus)
+	if err != nil {
+		return err
+	}
+	delete(unstructuredObj.Object["metadata"].(map[string]interface{}), "creationTimestamp")
+	delete(unstructuredObj.Object, "status")
+
+	// put UpdateService in yaml
+	osusBytes, err := yaml.Marshal(unstructuredObj.Object)
 	if err != nil {
 		return err
 	}
-	// creationTimestamp is a struct, omitempty does not apply
-	osusBytes = bytes.ReplaceAll(osusBytes, []byte("  creationTimestamp: null\n"), []byte(""))
-	osusBytes = bytes.ReplaceAll(osusBytes, []byte("status: {}\n"), []byte(""))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/pkg/clusterresources/clusterresources.go` around lines 639 - 646,
The current code uses bytes.ReplaceAll on yaml.Marshal output for osus to strip
"creationTimestamp: null" and "status: {}" which is fragile; instead perform
structural sanitization like the other generators: convert the UpdateService
object (osus) into an unstructured map (or decode osusBytes into a
map[string]interface{}), remove the "status" key and any
metadata.creationTimestamp entries from that map, then re-marshal that cleaned
map into YAML (replacing the current use of bytes.ReplaceAll on osusBytes).
Target symbols: osus (the UpdateService object), osusBytes, and the
UpdateService/UpdateServiceStatus fields to locate where to replace the
string-replace logic with an unstructured delete flow.
internal/pkg/clusterresources/clusterresources_test.go (1)

743-745: Please cover the template-backed CatalogSource path too.

This new assertion only exercises the default builder. Since TargetCatalogSourceTemplate accepts user-provided YAML, that subtest is the likeliest place for a top-level status block to sneak back in. Reusing verifyNoStatusField there would lock down the regression more completely.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/pkg/clusterresources/clusterresources_test.go` around lines 743 -
745, Add the same verifyNoStatusField assertion to the subtest that uses
TargetCatalogSourceTemplate: after the template-backed CatalogSource is rendered
and its file is written (the csFiles entry produced by that subtest), call
verifyNoStatusField(t, filepath.Join(workingDir, clusterResourcesDir, <that
csFiles entry>.Name())) so the CatalogSource created from
TargetCatalogSourceTemplate is also checked for a top-level status field;
reference the existing verifyNoStatusField helper and the
TargetCatalogSourceTemplate subtest’s csFiles entry to locate where to insert
the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@internal/pkg/clusterresources/clusterresources_test.go`:
- Around line 743-745: Add the same verifyNoStatusField assertion to the subtest
that uses TargetCatalogSourceTemplate: after the template-backed CatalogSource
is rendered and its file is written (the csFiles entry produced by that
subtest), call verifyNoStatusField(t, filepath.Join(workingDir,
clusterResourcesDir, <that csFiles entry>.Name())) so the CatalogSource created
from TargetCatalogSourceTemplate is also checked for a top-level status field;
reference the existing verifyNoStatusField helper and the
TargetCatalogSourceTemplate subtest’s csFiles entry to locate where to insert
the assertion.

In `@internal/pkg/clusterresources/clusterresources.go`:
- Around line 639-646: The current code uses bytes.ReplaceAll on yaml.Marshal
output for osus to strip "creationTimestamp: null" and "status: {}" which is
fragile; instead perform structural sanitization like the other generators:
convert the UpdateService object (osus) into an unstructured map (or decode
osusBytes into a map[string]interface{}), remove the "status" key and any
metadata.creationTimestamp entries from that map, then re-marshal that cleaned
map into YAML (replacing the current use of bytes.ReplaceAll on osusBytes).
Target symbols: osus (the UpdateService object), osusBytes, and the
UpdateService/UpdateServiceStatus fields to locate where to replace the
string-replace logic with an unstructured delete flow.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 5b5164d6-ee85-446d-856b-7e748e5b06c8

📥 Commits

Reviewing files that changed from the base of the PR and between dd6ccea and 1c6019c.

📒 Files selected for processing (2)
  • internal/pkg/clusterresources/clusterresources.go
  • internal/pkg/clusterresources/clusterresources_test.go

@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented Mar 11, 2026

/retest

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

openshift-ci Bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aguidirh, dorzel, nidangavali

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

@nidangavali
Copy link
Copy Markdown

/verified by @nidangavali

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@nidangavali: This PR has been marked as verified by @nidangavali.

Details

In response to this:

/verified by @nidangavali

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.

@aguidirh
Copy link
Copy Markdown
Contributor

@r4f4 could you please have a look when you have time?

Copy link
Copy Markdown
Contributor

@r4f4 r4f4 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 Mar 24, 2026
@aguidirh
Copy link
Copy Markdown
Contributor

/test integration

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 25, 2026

@dorzel: all tests passed!

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.

@openshift-merge-bot openshift-merge-bot Bot merged commit 7794c08 into openshift:main Mar 25, 2026
12 checks passed
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: Jira Issue Verification Checks: Jira Issue OCPBUGS-77146
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-77146 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

…, and UpdateService yaml files

Description

This removes the unneeded status field from generated CatalogSource, ClusterCatalog, and UpdateService yaml files. Similar fix to #1311.

Github / Jira issue: https://issues.redhat.com/browse/OCPBUGS-77146

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

Ran the m2d and d2m workflow described in the bug, with the ISC provided in the bug. Verified that that status field was gone on the generated CatalogSource, ClusterCatalog, and UpdateService files in the mirror working dir.

Expected Outcome

Status field no longer exists on the files in question.

Summary by CodeRabbit

  • Bug Fixes

  • Generated YAML manifests for CatalogSource, ClusterCatalog, and UpdateService now omit status fields, producing cleaner, production-ready configurations.

  • Tests

  • Added verification tests that assert status fields are absent from all generated manifest outputs and improved test messages for clearer failure context.

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.

@dorzel dorzel deleted the OCPBUGS-77146 branch March 25, 2026 16:22
@openshift-merge-robot
Copy link
Copy Markdown
Contributor

Fix included in accepted release 4.22.0-0.nightly-2026-03-25-221249

@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented Apr 6, 2026

/cherrypick release-4.21 release-4.20

@openshift-cherrypick-robot
Copy link
Copy Markdown

@dorzel: new pull request created: #1383

Details

In response to this:

/cherrypick release-4.21 release-4.20

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.

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-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants