Repository navigation
🌱 add ClusterObjectSet object collision and adoption e2e scenarios #3028
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
Merged
openshift-merge-bot
merged 1 commit into
operator-framework:main
from
perdasilva:cos-object-collision-adoption
Oct 19, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
363 changes: 363 additions & 0 deletions
363
test/e2e/features/cos_object_collision_and_adoption.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,363 @@ | ||
| @BoxcutterRuntime | ||
| Feature: ClusterObjectSet object collision and adoption | ||
|
|
||
| As an OLM user applying a ClusterObjectSet directly, I want the revision's | ||
| collisionProtection setting to control whether it refuses to manage objects | ||
| that already exist (reporting ObjectCollision) or adopts them, so that I can | ||
| choose how aggressively a revision takes ownership of pre-existing objects. | ||
|
|
||
| Background: | ||
| Given OLM is available | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Collisions: the revision refuses to take ownership (Ready=False/ObjectCollision) | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| Scenario: Prevent reports ObjectCollision for a pre-existing unowned object | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And resource is applied | ||
| """ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: pre-existing | ||
| """ | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: ${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: managed | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason ObjectCollision and Message includes: | ||
| """ | ||
| Cannot take ownership of 1 object(s) in phase "resources" because they are owned by another controller or already exist. | ||
| """ | ||
| And resource "configmap/shared-cm" matches | ||
| """ | ||
| data: | ||
| k: pre-existing | ||
| """ | ||
|
|
||
| Scenario: Prevent reports ObjectCollision for an object owned by another revision | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: owner-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: owner-${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: owned-by-owner | ||
| revision: 1 | ||
| """ | ||
| And ClusterObjectSet "owner-${TEST_NAMESPACE}" reports Ready as True with Reason AllObjectsReady | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: main-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: main-${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: contested | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "main-${TEST_NAMESPACE}" reports Ready as False with Reason ObjectCollision and Message includes: | ||
| """ | ||
| Cannot take ownership of 1 object(s) in phase "resources" because they are owned by another controller or already exist. | ||
| """ | ||
|
|
||
| Scenario: IfNoController reports ObjectCollision for an object owned by another revision | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: owner-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: owner-${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: owned-by-owner | ||
| revision: 1 | ||
| """ | ||
| And ClusterObjectSet "owner-${TEST_NAMESPACE}" reports Ready as True with Reason AllObjectsReady | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: main-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: main-${NAME} | ||
| collisionProtection: IfNoController | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: contested | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "main-${TEST_NAMESPACE}" reports Ready as False with Reason ObjectCollision and Message includes: | ||
| """ | ||
| Cannot take ownership of 1 object(s) in phase "resources" because they are owned by another controller or already exist. | ||
| """ | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Adoption: the revision takes ownership (Ready=True/AllObjectsReady) | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| Scenario: IfNoController adopts a pre-existing unowned object | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And resource is applied | ||
| """ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: pre-existing | ||
| """ | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: ${NAME} | ||
| collisionProtection: IfNoController | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: managed | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as True with Reason AllObjectsReady | ||
| And resource "configmap/shared-cm" matches | ||
| """ | ||
| data: | ||
| k: managed | ||
| """ | ||
|
|
||
| Scenario: None adopts a pre-existing unowned object | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And resource is applied | ||
| """ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: pre-existing | ||
| """ | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: ${NAME} | ||
| collisionProtection: None | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: managed | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as True with Reason AllObjectsReady | ||
| And resource "configmap/shared-cm" matches | ||
| """ | ||
| data: | ||
| k: managed | ||
| """ | ||
|
|
||
| Scenario: None adopts an object owned by another revision | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: owner-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: owner-${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: owned-by-owner | ||
| revision: 1 | ||
| """ | ||
| And ClusterObjectSet "owner-${TEST_NAMESPACE}" reports Ready as True with Reason AllObjectsReady | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: main-${TEST_NAMESPACE} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: main-${NAME} | ||
| collisionProtection: None | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: contested | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "main-${TEST_NAMESPACE}" reports Ready as True with Reason AllObjectsReady | ||
| And resource "configmap/shared-cm" matches | ||
| """ | ||
| data: | ||
| k: contested | ||
| """ | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Recovery: a collision clears once the conflicting object is removed | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
| Scenario: ClusterObjectSet recovers from ObjectCollision once the conflicting object is removed | ||
| Given namespace "${TEST_NAMESPACE}" is available | ||
| And resource is applied | ||
| """ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: pre-existing | ||
| """ | ||
| When ClusterObjectSet is applied | ||
| """ | ||
| apiVersion: olm.operatorframework.io/v1 | ||
| kind: ClusterObjectSet | ||
| metadata: | ||
| name: ${COS_NAME} | ||
| spec: | ||
| lifecycleState: Active | ||
| group: ${NAME} | ||
| collisionProtection: Prevent | ||
| phases: | ||
| - name: resources | ||
| objects: | ||
| - object: | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: shared-cm | ||
| namespace: ${TEST_NAMESPACE} | ||
| data: | ||
| k: managed | ||
| revision: 1 | ||
| """ | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as False with Reason ObjectCollision and Message includes: | ||
| """ | ||
| Cannot take ownership of 1 object(s) in phase "resources" because they are owned by another controller or already exist. | ||
| """ | ||
| When resource "configmap/shared-cm" is removed | ||
| And ClusterObjectSet "${COS_NAME}" reconciliation is triggered | ||
| Then ClusterObjectSet "${COS_NAME}" reports Ready as True with Reason AllObjectsReady | ||
| And resource "configmap/shared-cm" matches | ||
| """ | ||
| data: | ||
| k: managed | ||
| """ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In the future we may also consider to check that:
...or maybe not, since we own the code that does the adoption and I don't think we will change that too often 🤷🏻