fix(harbor): meter the registry bucket under the registry WorkloadMonitor (#5392)

## What this PR does

The WorkloadMonitor controller finds BucketClaims by the monitor's label
selector. The registry BucketClaim carried no labels, so it never got a
Workload and Harbor's object storage was invisible to billing. Before
the registry moved to S3 its PVC carried the vendored chart's release
and component labels and was reported under the registry monitor;
labelling the BucketClaim the same way restores that.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
fix(harbor): Harbor registry storage is billed again. The WorkloadMonitor controller finds BucketClaims by label, and the registry BucketClaim had no labels. It now carries the registry monitor's `release` and
  `component` labels, so its storage shows up as Workload under the registry WorkloadMonitor, the same way the registry PVC did before it moved to S3. And also registry WorkloadMonitor now reports not operational while the BucketClaim is not provisioned
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Improvements**
* Harbor registry storage claims now include release and component
labels, making them identifiable as part of the Harbor system and
registry.
* Registry workload monitoring now selects storage claims using these
labels.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aleksei Sviridkin authored and GitHub committed 2026-11-23 17:14:33 +03:00
commit a19846c77e
2 files changed
+49

No files matched your search

@@ -3,6 +3,9 @@ apiVersion: objectstorage.k8s.io/v1alpha1
kind: BucketClaim
metadata:
name: {{ .Release.Name }}-registry
labels:
release: {{ .Release.Name }}-system
component: registry
spec:
bucketClassName: {{ $seaweedfs }}
protocols:
@@ -0,0 +1,46 @@
suite: registry BucketClaim is selected by the registry WorkloadMonitor
release:
name: harbor
namespace: tenant-test
# The WorkloadMonitor controller lists BucketClaims by the monitor's selector,
# so a BucketClaim without matching labels gets no Workload and its storage
# never reaches billing. The registry keeps its images in this bucket, so it is
# reported under the registry monitor, as the registry PVC was before storage
# moved to S3. Both sides are asserted so that renaming either one fails here.
set:
_namespace:
host: example.org
ingress: nginx
gateway: ""
seaweedfs: seaweedfs
_cluster:
solver: http01
tests:
- it: labels the registry BucketClaim with the registry monitor's selector
template: templates/bucket.yaml
documentSelector:
path: kind
value: BucketClaim
asserts:
- equal:
path: metadata.labels
value:
release: harbor-system
component: registry
- it: selects the registry BucketClaim from the registry monitor
template: templates/harbor.yaml
documentSelector:
path: metadata.name
value: harbor-registry
asserts:
- isKind:
of: WorkloadMonitor
- equal:
path: spec.selector
value:
release: harbor-system
component: registry