Skip to content

Commit e5d8e94

Browse files
(doc) Add godoc comments to label constants
Adds documentation comments to all label/annotation constants explaining: - What each constant represents - Where they are applied (labels vs annotations) - ServiceAccount constants document their relationship to ClusterExtension spec Addresses code review feedback for improved maintainability.
1 parent 6fe7c3c commit e5d8e94

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

internal/operator-controller/controllers/revision_engine_factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type DefaultRevisionEngineFactory struct {
4242

4343
// CreateRevisionEngine constructs a boxcutter RevisionEngine for the given ClusterExtensionRevision.
4444
// It reads the ServiceAccount from annotations and creates a scoped client.
45-
func (f *DefaultRevisionEngineFactory) CreateRevisionEngine(ctx context.Context, rev *ocv1.ClusterExtensionRevision) (RevisionEngine, error) {
45+
func (f *DefaultRevisionEngineFactory) CreateRevisionEngine(_ context.Context, rev *ocv1.ClusterExtensionRevision) (RevisionEngine, error) {
4646
scopedClient, err := f.getScopedClient(rev)
4747
if err != nil {
4848
return nil, err
Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,42 @@
11
package labels
22

33
const (
4-
OwnerKindKey = "olm.operatorframework.io/owner-kind"
5-
OwnerNameKey = "olm.operatorframework.io/owner-name"
6-
PackageNameKey = "olm.operatorframework.io/package-name"
7-
BundleNameKey = "olm.operatorframework.io/bundle-name"
8-
BundleVersionKey = "olm.operatorframework.io/bundle-version"
9-
BundleReferenceKey = "olm.operatorframework.io/bundle-reference"
10-
ServiceAccountNameKey = "olm.operatorframework.io/service-account-name"
4+
// OwnerKindKey is the label key used to record the kind of the owner
5+
// resource responsible for creating or managing a ClusterExtensionRevision.
6+
OwnerKindKey = "olm.operatorframework.io/owner-kind"
7+
8+
// OwnerNameKey is the label key used to record the name of the owner
9+
// resource responsible for creating or managing a ClusterExtensionRevision.
10+
OwnerNameKey = "olm.operatorframework.io/owner-name"
11+
12+
// PackageNameKey is the label key used to record the package name
13+
// associated with a ClusterExtensionRevision.
14+
PackageNameKey = "olm.operatorframework.io/package-name"
15+
16+
// BundleNameKey is the label key used to record the bundle name
17+
// associated with a ClusterExtensionRevision.
18+
BundleNameKey = "olm.operatorframework.io/bundle-name"
19+
20+
// BundleVersionKey is the label key used to record the bundle version
21+
// associated with a ClusterExtensionRevision.
22+
BundleVersionKey = "olm.operatorframework.io/bundle-version"
23+
24+
// BundleReferenceKey is the label key used to record an external reference
25+
// (such as an image or catalog reference) to the bundle for a
26+
// ClusterExtensionRevision.
27+
BundleReferenceKey = "olm.operatorframework.io/bundle-reference"
28+
29+
// ServiceAccountNameKey is the annotation key used to record the name of
30+
// the ServiceAccount configured on the owning ClusterExtension. It is
31+
// applied as an annotation on ClusterExtensionRevision resources to
32+
// capture which ServiceAccount was used for their lifecycle operations.
33+
ServiceAccountNameKey = "olm.operatorframework.io/service-account-name"
34+
35+
// ServiceAccountNamespaceKey is the annotation key used to record the
36+
// namespace of the ServiceAccount configured on the owning
37+
// ClusterExtension. It is applied as an annotation on
38+
// ClusterExtensionRevision resources together with ServiceAccountNameKey
39+
// so that the effective ServiceAccount identity used for
40+
// ClusterExtensionRevision operations is preserved.
1141
ServiceAccountNamespaceKey = "olm.operatorframework.io/service-account-namespace"
1242
)

0 commit comments

Comments
 (0)