Skip to content

✨ add Available condition to ClusterObjectDeployment - #3046

Closed
perdasilva wants to merge 1 commit into
operator-framework:mainfrom
perdasilva:cod-available-condition
Closed

perdasilva wants to merge 1 commit into
operator-framework:mainfrom
perdasilva:cod-available-condition

Conversation

@perdasilva

@perdasilva perdasilva commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a per-deployment Available condition to ClusterObjectDeployment, complementing the existing Progressing condition introduced with the controller MVP (#3034).

Today a ClusterObjectDeployment only reports rollout progress. There's no single signal for whether the deployment is actually serving desired content. This PR adds that signal: Available reflects whether at least one active revision is Ready, so consumers can gate on availability independently of whether a new revision is mid-rollout.

Behavior

Available is derived from the owned ClusterObjectSet revisions each reconcile:

Status Reason When
True Available At least one active (non-archived, non-deleting) revision is Ready
False Unavailable Active revisions exist, but none are Ready yet
False NoActiveRevision No active revision exists (e.g. before the first revision is created)

Because it keys off any active Ready revision, the deployment stays Available=True across rollouts while a previous revision remains Ready and a new one is still progressing.

What's included

  • API: Available condition type + Available / Unavailable / NoActiveRevision reason constants; expanded status.conditions godoc.
  • Printer column: Available shown in kubectl get clusterobjectdeployment alongside Progressing.
  • Controller: setAvailable computed every reconcile; Progressing/Available now share a small setCondition helper.
  • Generated: CRD, experimental manifests, apply configuration, and API reference regenerated.

Testing

  • Unit tests (Test_ClusterObjectDeploymentReconciler_Available) cover all three states plus the cross-rollout case: a deployment stays Available while a new revision rolls out as long as a prior revision is still Ready.
  • go build, go vet, and go test ./internal/object-controller/... ./api/v1/... pass.

Notes

  • Scoped intentionally to the Available condition; no changes to collisionProtection, COS types, or indexing.
  • E2E coverage for Available is a planned follow-up on cod_rollout.feature.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (E2E to follow)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

Summary by CodeRabbit

  • New Features
    • Added an Available status condition for ClusterObjectDeployments.
    • Availability is reported as true when any active revision is ready, with distinct statuses for unavailable revisions and no active revision.
    • Added an Available column to ClusterObjectDeployment listings.
  • Documentation
    • Updated API and rollout documentation to describe availability behavior during initial deployment and revisions.

@openshift-ci
openshift-ci Bot requested review from joelanford and pedjak October 21, 2026 16:45
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 8961104e-3396-4fc9-90a7-56f2ddcbc200
📥 Commits

Reviewing files that changed from the base of the PR and between 0926aa5 and c23d187.

📒 Files selected for processing: 9
  • api/v1/clusterobjectdeployment_types.go
  • applyconfigurations/api/v1/clusterobjectdeploymentstatus.go
  • docs/api-reference/olmv1-api-reference.md
  • helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectdeployments.yaml
  • internal/object-controller/controllers/clusterobjectdeployment_controller.go
  • internal/object-controller/controllers/clusterobjectdeployment_controller_test.go
  • manifests/experimental-e2e.yaml
  • manifests/experimental.yaml
  • test/e2e/features/cod_rollout.feature

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

📝 Walkthrough

ClusterObjectDeployment now reports an Available condition based on active revision readiness. API documentation and CRDs describe its states and expose it as a printer column. Tests cover availability before and during revision rollouts.

Changes: Deployment availability

Layer / File(s) Summary
Define and calculate availability
api/v1/clusterobjectdeployment_types.go, internal/object-controller/controllers/clusterobjectdeployment_controller.go, internal/object-controller/controllers/clusterobjectdeployment_controller_test.go, test/e2e/features/cod_rollout.feature
The API defines the Available condition and its reasons. Reconciliation sets availability from active, non-deleting, non-archived revisions before revision selection. Tests cover no active revision, no Ready active revision, a Ready active revision, and availability during rollout.
Document and expose availability
api/v1/clusterobjectdeployment_types.go, applyconfigurations/api/v1/clusterobjectdeploymentstatus.go, docs/api-reference/olmv1-api-reference.md, helm/olmv1/base/object-controller/crd/experimental/olm.operatorframework.io_clusterobjectdeployments.yaml, manifests/experimental*.yaml
API and CRD descriptions document the availability outcomes. CRDs add an Available printer column.

Priority: ⬇️ Low

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

Change: Feature

Suggested reviewers: fao89

Merge Risk: ⚪ Minimal · up to c23d1

The availability change is ready to merge after normal checks; no material issue was established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: adding the Available condition to ClusterObjectDeployment.
Description check Passed The description explains the motivation, behavior, implementation scope, generated changes, and test coverage. It follows the template and completes the reviewer checklist. The related issue link item…
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: Description check

Explanation

The description explains the motivation, behavior, implementation scope, generated changes, and test coverage. It follows the template and completes the reviewer checklist. The related issue link item remains unchecked, but this is non-critical because the description references issue #3034.

Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@perdasilva
perdasilva marked this pull request as draft October 21, 2026 16:45
@netlify

netlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit c23d187
🔍 Latest deploy log https://app.netlify.com/projects/olmv1/deploys/6ad8ed30b80cda791e39c076
😎 Deploy Preview https://deploy-preview-3046--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@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 Oct 21, 2026
Report a per-deployment Available condition alongside Progressing. It is
True (reason Available) when at least one active, non-archived revision is
Ready, so the deployment stays available across rollouts while a prior
revision remains Ready; False with reason Unavailable when active revisions
exist but none are Ready, or NoActiveRevision when none exist. Adds an
Available print column, expands the status godoc, and asserts the condition
in the cod_rollout e2e feature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Per G. da Silva <pegoncal@redhat.com>
@perdasilva
perdasilva force-pushed the cod-available-condition branch from a7400dc to c23d187 Compare October 21, 2026 16:49
@perdasilva
perdasilva marked this pull request as ready for review October 21, 2026 16:52
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2026

@fao89 fao89 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.

/lgtm

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

Copy link
Copy Markdown
Member

/approve

I do see a failure in the experimental-e2e. Not sure if it is related, but I think the change itself looks good.

@openshift-ci

openshift-ci Bot commented Oct 21, 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 Oct 21, 2026
@perdasilva perdasilva closed this Oct 22, 2026
@perdasilva perdasilva reopened this Oct 22, 2026
@perdasilva perdasilva closed this Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.11%. Comparing base (0926aa5) to head (c23d187).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3046      +/-   ##
==========================================
+ Coverage   64.04%   64.11%   +0.06%     
==========================================
  Files         145      145              
  Lines       10338    10358      +20     
==========================================
+ Hits         6621     6641      +20     
  Misses       3268     3268              
  Partials      449      449              
Flag Coverage Δ
unit 64.11% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants