@@ -115,3 +115,187 @@ Feature: Recover cluster extension from errors that might occur during its lifet
115115 Then ClusterExtension is available
116116 And ClusterExtension reports Progressing as True with Reason Succeeded
117117 And ClusterExtension reports Installed as True
118+
119+ # CATALOG DELETION RESILIENCE SCENARIOS
120+
121+ Scenario : Extension continues running after catalog deletion
122+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
123+ And ClusterExtension is applied
124+ """
125+ apiVersion: olm.operatorframework.io/v1
126+ kind: ClusterExtension
127+ metadata:
128+ name: ${NAME}
129+ spec:
130+ namespace: ${TEST_NAMESPACE}
131+ serviceAccount:
132+ name: olm-sa
133+ source:
134+ sourceType: Catalog
135+ catalog:
136+ packageName: test
137+ selector:
138+ matchLabels:
139+ "olm.operatorframework.io/metadata.name": test-catalog
140+ """
141+ And ClusterExtension is rolled out
142+ And ClusterExtension is available
143+ And resource "deployment/test-operator" is available
144+ And resource "configmap/test-configmap" is available
145+ When ClusterCatalog "test" is deleted
146+ # Verify controller still maintains resources after catalog deletion by removing and restoring a resource.
147+ # This approach avoids race conditions because:
148+ # - We don't rely on status flags that might be unchanged (e.g., Installed=True before and after)
149+ # - Resource restoration is an observable event that PROVES the controller reconciled after deletion
150+ # - The controller must actively apply manifests to restore the removed resource
151+ And resource "configmap/test-configmap" is removed
152+ Then resource "configmap/test-configmap" is eventually restored
153+ And resource "deployment/test-operator" is available
154+
155+ Scenario : Resources are restored after catalog deletion
156+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
157+ And ClusterExtension is applied
158+ """
159+ apiVersion: olm.operatorframework.io/v1
160+ kind: ClusterExtension
161+ metadata:
162+ name: ${NAME}
163+ spec:
164+ namespace: ${TEST_NAMESPACE}
165+ serviceAccount:
166+ name: olm-sa
167+ source:
168+ sourceType: Catalog
169+ catalog:
170+ packageName: test
171+ selector:
172+ matchLabels:
173+ "olm.operatorframework.io/metadata.name": test-catalog
174+ """
175+ And ClusterExtension is rolled out
176+ And ClusterExtension is available
177+ And resource "configmap/test-configmap" exists
178+ And ClusterCatalog "test" is deleted
179+ When resource "configmap/test-configmap" is removed
180+ Then resource "configmap/test-configmap" is eventually restored
181+
182+ Scenario : Config changes are allowed even when the catalog does not exist anymore
183+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
184+ And ClusterExtension is applied
185+ """
186+ apiVersion: olm.operatorframework.io/v1
187+ kind: ClusterExtension
188+ metadata:
189+ name: ${NAME}
190+ spec:
191+ namespace: ${TEST_NAMESPACE}
192+ serviceAccount:
193+ name: olm-sa
194+ source:
195+ sourceType: Catalog
196+ catalog:
197+ packageName: test
198+ selector:
199+ matchLabels:
200+ "olm.operatorframework.io/metadata.name": test-catalog
201+ """
202+ And ClusterExtension is rolled out
203+ And ClusterExtension is available
204+ And ClusterCatalog "test" is deleted
205+ When ClusterExtension is updated to add preflight config
206+ """
207+ apiVersion: olm.operatorframework.io/v1
208+ kind: ClusterExtension
209+ metadata:
210+ name: ${NAME}
211+ spec:
212+ namespace: ${TEST_NAMESPACE}
213+ serviceAccount:
214+ name: olm-sa
215+ install:
216+ preflight:
217+ crdUpgradeSafety:
218+ enforcement: None
219+ source:
220+ sourceType: Catalog
221+ catalog:
222+ packageName: test
223+ selector:
224+ matchLabels:
225+ "olm.operatorframework.io/metadata.name": test-catalog
226+ """
227+ # Wait for reconciliation of the updated spec (config change should succeed without catalog)
228+ # First ensure the controller has reconciled the new generation (spec update)
229+ And ClusterExtension has reconciled the latest generation
230+ # Config-only changes don't trigger resolution failure (bundle unchanged), so resolution succeeds
231+ # using the installed bundle metadata. Verify reconciliation completed successfully.
232+ And ClusterExtension reports Progressing as True with Reason Succeeded
233+ Then ClusterExtension is available
234+ And ClusterExtension reports Installed as True
235+
236+ Scenario : Version upgrade does not proceed when catalog does not exist
237+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
238+ And ClusterExtension is applied
239+ """
240+ apiVersion: olm.operatorframework.io/v1
241+ kind: ClusterExtension
242+ metadata:
243+ name: ${NAME}
244+ spec:
245+ namespace: ${TEST_NAMESPACE}
246+ serviceAccount:
247+ name: olm-sa
248+ source:
249+ sourceType: Catalog
250+ catalog:
251+ packageName: test
252+ version: "1.0.0"
253+ selector:
254+ matchLabels:
255+ "olm.operatorframework.io/metadata.name": test-catalog
256+ """
257+ And ClusterExtension is rolled out
258+ And ClusterExtension is available
259+ And bundle "test-operator.1.0.0" is installed in version "1.0.0"
260+ When ClusterCatalog "test" is deleted
261+ And ClusterExtension is updated to version "1.0.1"
262+ # Wait for reconciliation after the version change request
263+ # Note: Retrying status means controller will auto-upgrade when catalog becomes available
264+ And ClusterExtension reports Progressing as True with Reason Retrying
265+ # Verify upgrade did not proceed: version remains at 1.0.0 (not 1.0.1)
266+ Then bundle "test-operator.1.0.0" is installed in version "1.0.0"
267+ And ClusterExtension reports Installed as True
268+
269+ @BoxcutterRuntime
270+ Scenario : Revision remains available after catalog deletion
271+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
272+ And ClusterExtension is applied
273+ """
274+ apiVersion: olm.operatorframework.io/v1
275+ kind: ClusterExtension
276+ metadata:
277+ name: ${NAME}
278+ spec:
279+ namespace: ${TEST_NAMESPACE}
280+ serviceAccount:
281+ name: olm-sa
282+ source:
283+ sourceType: Catalog
284+ catalog:
285+ packageName: test
286+ version: "1.2.0"
287+ selector:
288+ matchLabels:
289+ "olm.operatorframework.io/metadata.name": test-catalog
290+ """
291+ And ClusterExtension is rolled out
292+ And ClusterExtension is available
293+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
294+ # Catalog deletion should NOT affect workload availability
295+ # Resolution may succeed initially (using catalog cache), so we verify workload remains healthy
296+ When ClusterCatalog "test" is deleted
297+ Then ClusterExtension reports Progressing as True with Reason Succeeded
298+ And ClusterExtension is available
299+ And ClusterExtension reports Installed as True
300+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
301+ And resource "deployment/test-operator" is available
0 commit comments