-
Notifications
You must be signed in to change notification settings - Fork 73
🌱 chore(ci): Add test to check if user changes are preserved #2512
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 |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| @BoxcutterRuntime | ||
| Feature: Preserve user-managed fields on deployed resources | ||
| OLM uses Server-Side Apply with specific field ownership. Fields that OLM does | ||
| not declare ownership of (e.g. user-applied annotations and labels) belong to | ||
| other managers and must be preserved across reconciliation cycles. | ||
| Related: https://github.com/operator-framework/operator-lifecycle-manager/issues/3392 | ||
|
|
||
| Background: | ||
| Given OLM is available | ||
| And ClusterCatalog "test" serves bundles | ||
| And ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE} | ||
|
|
||
| Scenario: User-added annotations and labels coexist with bundle-defined labels after reconciliation | ||
| When 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 | ||
| """ | ||
| Then ClusterExtension is rolled out | ||
| And ClusterExtension is available | ||
| And resource "deployment/test-operator" is available | ||
| # The bundle defines labels on the deployment via the CSV spec; verify they are present | ||
| And resource "deployment/test-operator" has label "app.kubernetes.io/name" with value "test-operator" | ||
|
Comment on lines
+14
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a large |
||
| When user adds annotation "example.com/custom-annotation=my-value" to "deployment/test-operator" | ||
| And user adds label "example.com/custom-label=my-value" to "deployment/test-operator" | ||
| Then resource "deployment/test-operator" has annotation "example.com/custom-annotation" with value "my-value" | ||
| And resource "deployment/test-operator" has label "example.com/custom-label" with value "my-value" | ||
|
Comment on lines
+39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to check it here, first we assert that the extension got reconciled. Hence, we can remove these two lines. |
||
| When ClusterExtension reconciliation is triggered | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be |
||
| And ClusterExtension has been reconciled the latest generation | ||
| Then resource "deployment/test-operator" has annotation "example.com/custom-annotation" with value "my-value" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can improve readability of this step if you allow specifying multiple (key, value) pairs, aka data tables something like: |
||
| And resource "deployment/test-operator" has label "example.com/custom-label" with value "my-value" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar as above, but for labels. |
||
| # Bundle-defined labels must still be intact after reconciliation | ||
| And resource "deployment/test-operator" has label "app.kubernetes.io/name" with value "test-operator" | ||
|
|
||
| Scenario: Deployment rollout restart persists after OLM reconciliation | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove this test, because it adds annotations to deployment and we have covered that in the previous test. |
||
| When 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 | ||
| """ | ||
| Then ClusterExtension is rolled out | ||
| And ClusterExtension is available | ||
| And resource "deployment/test-operator" is available | ||
| When user performs rollout restart on "deployment/test-operator" | ||
| Then deployment "test-operator" has restart annotation | ||
| And deployment "test-operator" rollout is complete | ||
| And deployment "test-operator" has 2 replica sets | ||
| When ClusterExtension reconciliation is triggered | ||
| And ClusterExtension has been reconciled the latest generation | ||
| Then deployment "test-operator" has restart annotation | ||
| And deployment "test-operator" rollout is complete | ||
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 drop the first sentence, it is too implementation oriented. The rest of explanation is great.