mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
fix(harbor): meter the registry bucket under the registry WorkloadMonitor
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. Assisted-by: LLM Signed-off-by: Ray Low <crossrt@gmail.com>
This commit is contained in:
1 parent
382169be52
commit
732165eebd
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
|
||||
Reference in new issue
Block a user