-
Notifications
You must be signed in to change notification settings - Fork 73
🐛 Add bundle-version and package-name annotations to CER phase objects #2580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -75,6 +75,11 @@ func (r *SimpleRevisionGenerator) GenerateRevisionFromHelmRelease( | |||||||||||||||||||||||||||||||
| _ = cache.ApplyStripAnnotationsTransform(&obj) | ||||||||||||||||||||||||||||||||
| sanitizedUnstructured(ctx, &obj) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| obj.SetAnnotations(mergeLabelMaps(obj.GetAnnotations(), map[string]string{ | ||||||||||||||||||||||||||||||||
| labels.BundleVersionKey: helmRelease.Labels[labels.BundleVersionKey], | ||||||||||||||||||||||||||||||||
| labels.PackageNameKey: helmRelease.Labels[labels.PackageNameKey], | ||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+81
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| objs = append(objs, *ocv1ac.ClusterExtensionRevisionObject(). | ||||||||||||||||||||||||||||||||
| WithObject(obj)) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
@@ -146,6 +151,11 @@ func (r *SimpleRevisionGenerator) GenerateRevision( | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| sanitizedUnstructured(ctx, &unstr) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| unstr.SetAnnotations(mergeLabelMaps(unstr.GetAnnotations(), map[string]string{ | ||||||||||||||||||||||||||||||||
| labels.BundleVersionKey: revisionAnnotations[labels.BundleVersionKey], | ||||||||||||||||||||||||||||||||
| labels.PackageNameKey: revisionAnnotations[labels.PackageNameKey], | ||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
Comment on lines
+154
to
+158
|
||||||||||||||||||||||||||||||||
| unstr.SetAnnotations(mergeLabelMaps(unstr.GetAnnotations(), map[string]string{ | |
| labels.BundleVersionKey: revisionAnnotations[labels.BundleVersionKey], | |
| labels.PackageNameKey: revisionAnnotations[labels.PackageNameKey], | |
| })) | |
| annotationUpdates := map[string]string{} | |
| if v := revisionAnnotations[labels.BundleVersionKey]; v != "" { | |
| annotationUpdates[labels.BundleVersionKey] = v | |
| } | |
| if v := revisionAnnotations[labels.PackageNameKey]; v != "" { | |
| annotationUpdates[labels.PackageNameKey] = v | |
| } | |
| if len(annotationUpdates) > 0 { | |
| unstr.SetAnnotations(mergeLabelMaps(unstr.GetAnnotations(), annotationUpdates)) | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,10 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T) | |
| "labels": map[string]interface{}{ | ||
| "my-label": "my-value", | ||
| }, | ||
| "annotations": map[string]interface{}{ | ||
| "olm.operatorframework.io/bundle-version": "1.2.0", | ||
| "olm.operatorframework.io/package-name": "my-package", | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
|
|
@@ -140,6 +144,10 @@ func Test_SimpleRevisionGenerator_GenerateRevisionFromHelmRelease(t *testing.T) | |
| "labels": map[string]interface{}{ | ||
| "my-label": "my-value", | ||
| }, | ||
| "annotations": map[string]interface{}{ | ||
| "olm.operatorframework.io/bundle-version": "1.2.0", | ||
| "olm.operatorframework.io/package-name": "my-package", | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
|
|
@@ -223,6 +231,10 @@ func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) { | |
| "kind": "Service", | ||
| "metadata": map[string]interface{}{ | ||
| "name": "test-service", | ||
| "annotations": map[string]interface{}{ | ||
| "olm.operatorframework.io/bundle-version": "", | ||
| "olm.operatorframework.io/package-name": "", | ||
| }, | ||
| }, | ||
| "spec": map[string]interface{}{}, | ||
| }, | ||
|
|
@@ -244,6 +256,8 @@ func Test_SimpleRevisionGenerator_GenerateRevision(t *testing.T) { | |
| }, | ||
| "annotations": map[string]interface{}{ | ||
| "my-annotation": "my-annotation-value", | ||
| "olm.operatorframework.io/bundle-version": "", | ||
| "olm.operatorframework.io/package-name": "", | ||
| }, | ||
|
Comment on lines
234
to
261
|
||
| }, | ||
| "spec": map[string]interface{}{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -180,6 +180,36 @@ Feature: Update ClusterExtension | |||||||||||||
| When ClusterCatalog "test" image version "v2" is also tagged as "latest" | ||||||||||||||
| Then bundle "test-operator.1.3.0" is installed in version "1.3.0" | ||||||||||||||
|
|
||||||||||||||
| @BoxcutterRuntime | ||||||||||||||
| Scenario: Update to a version with identical bundle content creates a new revision | ||||||||||||||
| Given ClusterExtension is applied | ||||||||||||||
| """ | ||||||||||||||
| apiVersion: olm.operatorframework.io/v1 | ||||||||||||||
| kind: ClusterExtension | ||||||||||||||
| metadata: | ||||||||||||||
| name: ${NAME} | ||||||||||||||
| spec: | ||||||||||||||
| namespace: ${TEST_NAMESPACE} | ||||||||||||||
| serviceAccount: | ||||||||||||||
| name: olm-sa | ||||||||||||||
| source: | ||||||||||||||
| sourceType: Catalog | ||||||||||||||
| catalog: | ||||||||||||||
| packageName: test | ||||||||||||||
| selector: | ||||||||||||||
| matchLabels: | ||||||||||||||
| "olm.operatorframework.io/metadata.name": test-catalog | ||||||||||||||
| version: 1.0.0 | ||||||||||||||
| upgradeConstraintPolicy: SelfCertified | ||||||||||||||
| """ | ||||||||||||||
| And ClusterExtension is rolled out | ||||||||||||||
| And ClusterExtension is available | ||||||||||||||
| And bundle "test-operator.1.0.0" is installed in version "1.0.0" | ||||||||||||||
| When ClusterExtension is updated to version "1.0.4" | ||||||||||||||
| Then ClusterExtension is rolled out | ||||||||||||||
| And ClusterExtension is available | ||||||||||||||
| And bundle "test-operator.1.0.4" is installed in version "1.0.4" | ||||||||||||||
|
||||||||||||||
| And bundle "test-operator.1.0.4" is installed in version "1.0.4" | |
| And bundle "test-operator.1.0.4" is installed in version "1.0.4" | |
| And ClusterExtension reports "${NAME}-2" as active revision | |
| And ClusterExtensionRevision "${NAME}-2" reports Progressing as True with Reason Succeeded | |
| And ClusterExtensionRevision "${NAME}-2" reports Available as True with Reason ProbesSucceeded | |
| And ClusterExtensionRevision "${NAME}-1" is archived |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are trying to address: https://github.com/operator-framework/operator-controller/pull/2578/changes
I used the ownerRef to do so, but the PackageName and Version I think might be a better choice.
So @pedjak
Can you please just address Copilot comments?
Then, I think we are OK with this one to get merged