Skip to content

fix(workloadmonitor): report a bucket's workloads not ready until its claim is provisioned - #5096

Merged
Aleksei Sviridkin (lexfrei) merged 2 commits into
cozystack:mainfrom
yankawai:fix/workloadmonitor-bucketclaim-ready
Nov 13, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 2 commits into
cozystack:mainfrom
yankawai:fix/workloadmonitor-bucketclaim-ready

Conversation

@yankawai

@yankawai europrinter (yankawai) commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

A Bucket app reports WorkloadsReady=True while its BucketClaim is never provisioned. On a v1.6.5 cluster a tenant got a BucketClaim for bucket class tenant-root, the root tenant there runs no SeaweedFS, and for three days the claim had no status while the objectstorage controller kept emitting FailedCreateBucket with bucketclasses.objectstorage.k8s.io "tenant-root" not found. The Bucket app showed Ready and WorkloadsReady the whole time.

The WorkloadMonitor controller already writes a Workload per BucketClaim with Operational set from status.bucketReady, but the monitor itself counts only pods. The bucket chart renders its monitor with replicas: 0 and minReplicas: 0, so the monitor stays operational whatever happens to the claim.

The monitor now names every selected BucketClaim that is not provisioned in status.message, sets status.reason to the new BucketClaimNotReady and turns Operational false, the same way it already reports a DataVolume that is not ready. A DataVolume verdict keeps the fields when both apply. BucketClaims are listed on every pass, so a stored BucketClaim verdict is recomputed rather than kept like an unread DataVolume verdict, and it clears once the claim is provisioned. Any monitor whose selector picks a BucketClaim follows its readiness, which is what the Workload objects already say. The Application then shows WorkloadsReady=False with that message and reason. Its Ready condition keeps following the HelmRelease, as pkg/registry/apps/application/rest.go intends.

Three new tests cover a provisioned claim, a claim not provisioned with and without a class, a claim outside the selector, the verdict clearing after provisioning with and without a DataVolume reader, and the DataVolume verdict winning over the BucketClaim one. Against the controller on main the four not-provisioned and clearing cases fail and the rest pass. go test ./internal/controller/... and go vet pass. make generate does not run on my machine, gengo fails to parse the go1.27.1 standard library, so I ran the controller-gen object and crd steps of hack/update-codegen.sh for ./api/v1alpha1/... directly. The deepcopy file is unchanged and the generated WorkloadMonitor CRD matches packages/system/cozystack-controller/definitions/cozystack.io_workloadmonitors.yaml. I have not run the change on a live cluster.

#5083 changes the Workload names of the same BucketClaims and does not touch the monitor status, so the two do not overlap.

Screenshots

Not a UI change.

Downstream repositories

The controller, one exported constant and its tests. No CRD schema, values key, default, telemetry metric or package change, so no trigger map entry applies.

Release note

fix(workloadmonitor): a Bucket app reports WorkloadsReady=False with reason BucketClaimNotReady while its BucketClaim is not provisioned, instead of WorkloadsReady=True.

Summary by CodeRabbit

  • New Features
    • Workload monitors now report when a selected bucket claim is not provisioned and mark the monitor as non-operational. Status messages include the bucket class when available and list multiple unprovisioned claims in sorted order.
  • Bug Fixes
    • The bucket-claim status clears when the claim is provisioned or no longer selected. When DataVolume information is available, its status takes precedence over the bucket-claim status.

@github-actions github-actions Bot added area/monitoring Issues or PRs related to the monitoring stack (vlogs, vmstack, grafana, workloadmonitor) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files labels Oct 25, 2026
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9d33037 and e8c8fa3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

WorkloadMonitor reconciliation now reports selected unprovisioned BucketClaims as non-operational. It records a reason and message, clears them when the claims become ready, and gives a readable DataVolume verdict precedence.

Changes: BucketClaim readiness status

Layer / File(s) Summary
BucketClaim verdict reconciliation
api/v1alpha1/workloadmonitor_types.go, internal/controller/workloadmonitor_controller.go, internal/controller/workloadmonitor_controller_test.go
Adds the BucketClaimNotReady reason and a sorted message for unready claims. Reconciliation applies this verdict when no readable DataVolume verdict takes precedence, and clears it when the claims become ready. Tests cover readiness, selector matching, recovery, and DataVolume precedence.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: Minimal · previous review 9d330

BucketClaim readiness can update workload status, and no material merge-blocking risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: reporting workloads as not ready until the selected BucketClaim is provisioned.
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
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.
Finishing Touches

Generate unit tests (beta)

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

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between eafc23d and 9d33037.

Files selected for processing: 2

  • internal/controller/workloadmonitor_controller.go
  • internal/controller/workloadmonitor_controller_test.go

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

@yankawai europrinter (yankawai) changed the title fix(workloadmonitor): keep a bucket not ready until its claim is provisioned fix(workloadmonitor): report a bucket's workloads not ready until its claim is provisioned Oct 25, 2026
…isioned

A bucket WorkloadMonitor has no pods and minReplicas 0, so it stayed
operational, and the Bucket app stayed Ready, while its BucketClaim was
never provisioned. A tenant whose nearest S3 ancestor runs no SeaweedFS
gets a claim for a bucket class that does not exist, and the dashboard
showed a ready bucket that was never created.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <[email protected]>
@yankawai
europrinter (yankawai) force-pushed the fix/workloadmonitor-bucketclaim-ready branch from eafc23d to 9d33037 Compare November 1, 2026 09:42
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
@lexfrei

Copy link
Copy Markdown
Contributor

europrinter (@yankawai) I merged main into your branch (e8c8fa3) so CI runs against the current base. Your commits are unchanged.

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.

europrinter (@yankawai) LGTM, CI and E2E are green on this head.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 6f8171d into cozystack:main Nov 13, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/monitoring Issues or PRs related to the monitoring stack (vlogs, vmstack, grafana, workloadmonitor) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants