Skip to content

⚠ Scope condition type and reason constants per API - #3205

Merged
openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
perdasilva:scoped-condition-consts
Nov 24, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
operator-framework:mainfrom
perdasilva:scoped-condition-consts

Conversation

@perdasilva

@perdasilva perdasilva commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Addresses the naming feedback from the GA API shape review (#3190 (comment)): unscoped condition type/reason constants (e.g. TypeInstalled, ReasonSucceeded) make it easy to accidentally use a constant with the wrong API, and hard for humans and bots to spot such mistakes.

Changes

  • Rename all ClusterExtension condition types/reasons to ClusterExtensionType* / ClusterExtensionReason*; the constants formerly in common_types.go now live in clusterextension_types.go and common_types.go is removed.
  • Rename ClusterCatalog condition constants to ClusterCatalogType* / ClusterCatalogReason* and add ClusterCatalogTypeProgressing plus ClusterCatalogReason{Succeeded,Retrying,Blocked}: catalogd was previously borrowing ClusterExtension's constants for the ClusterCatalog Progressing condition — exactly the cross-API misuse this rename prevents.
  • ClusterObjectDeploymentReasonProgressDeadlineExceeded is now defined directly instead of aliasing the shared constant.
  • The clusterextension_types_test.go completeness test now enforces the scoped naming convention.

Constant values are unchanged — CRD schemas, conditions written to the cluster, and stored objects are unaffected. Only Go identifiers change.

Breaking change

Removing the unscoped exported constants is a breaking change for Go consumers of api/v1. This PR needs the go-apidiff-override label.

Testing

  • go build ./...
  • Unit tests: api/v1, internal/operator-controller/..., internal/catalogd/..., internal/object-controller/..., internal/shared/..., hack/tools/crd-generator/...
  • go vet ./test/... ./hack/tools/crd-generator/...

Summary by CodeRabbit

  • Improvements
    • Standardized condition names and reasons across catalog and extension statuses.
    • Added clearer progress states for catalogs, including succeeded, retrying, and blocked outcomes.
    • Preserved existing status behavior and messages.

Rename the unscoped condition type and reason constants to
kind-scoped names (ClusterExtensionType*/ClusterExtensionReason*,
ClusterCatalogType*/ClusterCatalogReason*) so it is immediately
clear which API each constant belongs to and cross-API misuse is
easy to spot:

- ClusterExtension constants formerly spread across common_types.go
  and clusterextension_types.go now live in clusterextension_types.go;
  common_types.go is removed.
- ClusterCatalog gains its own Progressing-condition constants
  (ClusterCatalogTypeProgressing, ClusterCatalogReasonSucceeded,
  Retrying, Blocked), which catalogd previously borrowed from
  ClusterExtension.
- ClusterObjectDeploymentReasonProgressDeadlineExceeded is defined
  directly instead of aliasing the shared constant.

Constant values are unchanged; only Go identifiers change. This is
a breaking change for Go consumers of the removed unscoped
constants.

Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
@netlify

netlify Bot commented Nov 24, 2026

Copy link
Copy Markdown

👷 Deploy request for olmv1 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 5b6d3f8

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change replaces shared condition constants with ClusterCatalog- and ClusterExtension-scoped constants. It updates controller logic, catalog validation, tests, and end-to-end checks to use the scoped names. Existing condition values and status outcomes are unchanged.

Changes: Condition Constant Scoping

Layer / File(s) Summary
Scoped condition constants
api/v1/clustercatalog_types.go, api/v1/clusterextension_types.go, api/v1/clusterobjectdeployment_types.go, api/v1/common_types.go, api/v1/clusterextension_types_test.go, hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go
Adds ClusterCatalog- and ClusterExtension-scoped condition constants, removes the shared condition constants file, and updates constant-registration checks and generator test data.
ClusterCatalog condition handling
internal/catalogd/controllers/core/clustercatalog_controller.go, internal/catalogd/controllers/core/clustercatalog_controller_test.go, internal/operator-controller/catalogmetadata/client/*, test/internal/e2e/steps/upgrade_steps.go
Updates catalog status handling, validation, tests, and end-to-end checks to use ClusterCatalog-scoped constants.
ClusterExtension condition handling
internal/operator-controller/applier/provider.go, internal/operator-controller/conditionsets/conditionsets.go, internal/operator-controller/controllers/clusterextension_controller.go, internal/operator-controller/controllers/clusterextension_reconcile_steps.go, internal/operator-controller/controllers/common_controller.go, internal/operator-controller/controllers/clusterextension_controller_test.go, internal/operator-controller/controllers/common_controller_test.go, internal/shared/util/error/terminal.go, test/*
Updates ClusterExtension condition creation, reason mapping, deprecation handling, tests, and end-to-end checks to use ClusterExtension-scoped constants.
ClusterObjectDeployment condition mapping
internal/object-controller/controllers/clusterobjectdeployment_deadline_test.go, internal/operator-controller/controllers/clusterobjectdeployment_status.go, internal/operator-controller/controllers/clusterobjectdeployment_status_test.go
Updates deployment condition mapping and its tests to use ClusterExtension-scoped constants and reasons.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: camilamacedo86, tmshort, fao89

Merge Risk: Minimal · up to 5b6d3

This change renames condition constants without changing the condition values written to the cluster, so runtime behavior should be unchanged. Go consumers of api/v1 will need to adopt the new names, and the PR calls for the go-apidiff-override label. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "⚠ Scope condition type and reason constants per API" names the primary change: the renaming of condition type and reason constants to API-scoped names (ClusterExtensionType*/ClusterExtensio…
Description check Passed The description covers the template's required content. It has a Description/Motivation section that explains why the rename is needed, and a Changes section that lists the work. It notes the breaking…
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.
Full details: Title check

Explanation

The title "⚠ Scope condition type and reason constants per API" names the primary change: the renaming of condition type and reason constants to API-scoped names (ClusterExtensionType*/ClusterExtensionReason* and ClusterCatalogType*/ClusterCatalogReason*). It also carries the breaking-change icon that the repository template requires. It is specific and matches the changeset, and it does not mention the secondary items (the new Progressing constants for ClusterCatalog, the removal of common_types.go, or the ClusterObjectDeployment literal change), which is acceptable.

Full details: Description check

Explanation

The description covers the template's required content. It has a Description/Motivation section that explains why the rename is needed, and a Changes section that lists the work. It notes the breaking change and the go-apidiff-override label, and it lists the tests that were run. The Reviewer Checklist from the template is not present, and the description does not link a GitHub issue directly, though it links a related review discussion. These gaps are non-critical, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 0ad4af98-a340-485a-a2d4-0ba64c3b0a3e
Commits

Reviewing files that changed from the base of the PR and between 5db77e7 and 5b6d3f8.

Files selected for processing: 24

  • api/v1/clustercatalog_types.go
  • api/v1/clusterextension_types.go
  • api/v1/clusterextension_types_test.go
  • api/v1/clusterobjectdeployment_types.go
  • api/v1/common_types.go
  • hack/tools/crd-generator/testdata/api/v1/clusterextension_types.go
  • internal/catalogd/controllers/core/clustercatalog_controller.go
  • internal/catalogd/controllers/core/clustercatalog_controller_test.go
  • internal/object-controller/controllers/clusterobjectdeployment_deadline_test.go
  • internal/operator-controller/applier/provider.go
  • internal/operator-controller/catalogmetadata/client/client.go
  • internal/operator-controller/catalogmetadata/client/client_test.go
  • internal/operator-controller/conditionsets/conditionsets.go
  • internal/operator-controller/controllers/clusterextension_controller.go
  • internal/operator-controller/controllers/clusterextension_controller_test.go
  • internal/operator-controller/controllers/clusterextension_reconcile_steps.go
  • internal/operator-controller/controllers/clusterobjectdeployment_status.go
  • internal/operator-controller/controllers/clusterobjectdeployment_status_test.go
  • internal/operator-controller/controllers/common_controller.go
  • internal/operator-controller/controllers/common_controller_test.go
  • internal/shared/util/error/terminal.go
  • test/extension-developer-e2e/extension_developer_test.go
  • test/internal/e2e/operator-controller/steps/steps.go
  • test/internal/e2e/steps/upgrade_steps.go
Files with no reviewable changes: 1

  • api/v1/common_types.go

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

perdasilva pushed a commit to perdasilva/operator-controller that referenced this pull request Nov 24, 2026
Mirror the kind-scoped constant naming from operator-framework#3205 in the GA shape
review copies: ClusterExtension condition types and reasons are
ClusterExtensionType*/ClusterExtensionReason* and live in
clusterextension_types.go; common_types.go is removed. The GA shape's
Ready condition is retained (rather than main's Available).

Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
@joelanford

Copy link
Copy Markdown
Member

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 24, 2026
@openshift-ci

openshift-ci Bot commented Nov 24, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelanford

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 Nov 24, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit a2b8506 into operator-framework:main Nov 24, 2026
37 checks passed
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. go-apidiff-override lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants