🐛 Fix: Use labels for queryable bundle metadata and unify owner labels#2345
🐛 Fix: Use labels for queryable bundle metadata and unify owner labels#2345camilamacedo86 wants to merge 1 commit into
Conversation
Fix bundle metadata storage to use labels instead of annotations, following Kubernetes best practices for queryable metadata. This enables kubectl queries like: kubectl get clusterextensionrevisions -l package-name=prometheus Also fixes inconsistent owner labels - now uses owner-name + owner-kind everywhere (previously ClusterExtensionRevision used just owner). Fixed issues: - Bundle metadata was in annotations (not queryable/indexed) - Owner labels were inconsistent across object types - Variable storeLbls was misleadingly named (actually annotations) Boxcutter runtime only - Helm unchanged except interface signature. Refs: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels Assisted-by: Cursor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull Request Overview
This PR improves ClusterExtensionRevision observability by moving bundle metadata (package-name, bundle-name, bundle-version) from annotations to labels, enabling kubectl queries and filtering. It also unifies owner label patterns across all resources by using both owner-kind and owner-name labels consistently, and improves code clarity by renaming variables to better reflect their purpose.
- Bundle metadata moved to labels for queryability via
kubectl get -l - Owner labels unified to use
owner-kind+owner-namepattern on ClusterExtensionRevision objects - Variable names improved (
storeLbls→revisionLabels/revisionAnnotations) for clarity
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/operator-controller/controllers/clusterextensionrevision_controller.go | Updated owner label constant from owner to owner-name |
| internal/operator-controller/controllers/clusterextension_controller.go | Split bundle metadata into labels (queryable) and annotations (reference); updated interface documentation |
| internal/operator-controller/applier/boxcutter.go | Updated revision generation to use labels for bundle metadata and added owner-kind/owner-name labels consistently |
| internal/operator-controller/applier/boxcutter_test.go | Updated all tests to expect bundle metadata in labels instead of annotations, and verify new owner label patterns |
| internal/operator-controller/applier/helm.go | Added new parameter for revision annotations (ignored by Helm applier) |
| internal/operator-controller/applier/helm_test.go | Updated all test calls to include new revision annotations parameter |
| internal/operator-controller/controllers/suite_test.go | Updated MockApplier signature to match new interface with three map parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // It takes objectLabels to be applied to all managed resources, revisionLabels to be applied to the | ||
| // ClusterExtensionRevision for selection/querying, and revisionAnnotations for non-queryable metadata. |
There was a problem hiding this comment.
The interface documentation is specific to the Boxcutter implementation (mentioning "ClusterExtensionRevision") but this interface is also implemented by the Helm applier which doesn't use ClusterExtensionRevision.
Consider making the documentation more generic to cover both implementations:
// It takes objectLabels to be applied to all managed resources, revisionLabels for queryable
// bundle metadata (stored on ClusterExtensionRevision for Boxcutter or Helm release for Helm),
// and revisionAnnotations for non-queryable metadata (ignored by Helm applier).| // It takes objectLabels to be applied to all managed resources, revisionLabels to be applied to the | |
| // ClusterExtensionRevision for selection/querying, and revisionAnnotations for non-queryable metadata. | |
| // It takes objectLabels to be applied to all managed resources, revisionLabels for queryable | |
| // bundle metadata (stored on a resource such as ClusterExtensionRevision for Boxcutter or Helm release for Helm), | |
| // and revisionAnnotations for non-queryable metadata (which may be ignored by some implementations). |
Problem
Bundle metadata (package-name, bundle-name, bundle-version) was stored in annotations on ClusterExtensionRevision, making it impossible to query or filter revisions by package, bundle, or version. Additionally, owner labels were inconsistent across different object types.
Solution
owner-name+owner-kindconsistently on all objectsstoreLblsvariable torevisionLabels+revisionAnnotationsChanges
BEFORE
ClusterExtensionRevision Resource
kubectl Queries (Didn't Work)
AFTER
ClusterExtensionRevision Resource
kubectl Queries (Now Work!)
Code Changes
BEFORE (Confusing and Wrong)
AFTER (Clear and Correct)
Rationale
Following Kubernetes best practices:
Labels (for selection/filtering)
kubectl get -l)Annotations (for reference data)
Decision:
package-name,bundle-name,bundle-version→ Labels (short, queryable)bundle-reference→ Annotation (can be >63 chars:quay.io/org/image@sha256:...)References