@@ -115,3 +115,227 @@ 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+ And ClusterCatalog "test" is deleted
146+ # Catalog deletion triggers automatic reconciliation via ClusterCatalog watch
147+ # Wait for reconciliation to complete by checking the status condition
148+ When ClusterExtension reports Installed as True
149+ Then resource "deployment/test-operator" is available
150+ And resource "configmap/test-configmap" is available
151+
152+ Scenario : Resources are restored after catalog deletion
153+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
154+ And ClusterExtension is applied
155+ """
156+ apiVersion: olm.operatorframework.io/v1
157+ kind: ClusterExtension
158+ metadata:
159+ name: ${NAME}
160+ spec:
161+ namespace: ${TEST_NAMESPACE}
162+ serviceAccount:
163+ name: olm-sa
164+ source:
165+ sourceType: Catalog
166+ catalog:
167+ packageName: test
168+ selector:
169+ matchLabels:
170+ "olm.operatorframework.io/metadata.name": test-catalog
171+ """
172+ And ClusterExtension is rolled out
173+ And ClusterExtension is available
174+ And resource "configmap/test-configmap" exists
175+ And ClusterCatalog "test" is deleted
176+ When resource "configmap/test-configmap" is removed
177+ Then resource "configmap/test-configmap" is eventually restored
178+
179+ Scenario : Config changes are allowed even when the catalog does not exist anymore
180+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
181+ And ClusterExtension is applied
182+ """
183+ apiVersion: olm.operatorframework.io/v1
184+ kind: ClusterExtension
185+ metadata:
186+ name: ${NAME}
187+ spec:
188+ namespace: ${TEST_NAMESPACE}
189+ serviceAccount:
190+ name: olm-sa
191+ source:
192+ sourceType: Catalog
193+ catalog:
194+ packageName: test
195+ selector:
196+ matchLabels:
197+ "olm.operatorframework.io/metadata.name": test-catalog
198+ """
199+ And ClusterExtension is rolled out
200+ And ClusterExtension is available
201+ And ClusterCatalog "test" is deleted
202+ When ClusterExtension is updated to add preflight config
203+ """
204+ apiVersion: olm.operatorframework.io/v1
205+ kind: ClusterExtension
206+ metadata:
207+ name: ${NAME}
208+ spec:
209+ namespace: ${TEST_NAMESPACE}
210+ serviceAccount:
211+ name: olm-sa
212+ install:
213+ preflight:
214+ crdUpgradeSafety:
215+ enforcement: None
216+ source:
217+ sourceType: Catalog
218+ catalog:
219+ packageName: test
220+ selector:
221+ matchLabels:
222+ "olm.operatorframework.io/metadata.name": test-catalog
223+ """
224+ # Wait for reconciliation of the updated spec (config change should succeed without catalog)
225+ And ClusterExtension is available
226+ Then ClusterExtension reports Installed as True
227+
228+ Scenario : Version upgrade does not proceed when catalog does not exist
229+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
230+ And ClusterExtension is applied
231+ """
232+ apiVersion: olm.operatorframework.io/v1
233+ kind: ClusterExtension
234+ metadata:
235+ name: ${NAME}
236+ spec:
237+ namespace: ${TEST_NAMESPACE}
238+ serviceAccount:
239+ name: olm-sa
240+ source:
241+ sourceType: Catalog
242+ catalog:
243+ packageName: test
244+ version: "1.0.0"
245+ selector:
246+ matchLabels:
247+ "olm.operatorframework.io/metadata.name": test-catalog
248+ """
249+ And ClusterExtension is rolled out
250+ And ClusterExtension is available
251+ And bundle "test-operator.1.0.0" is installed in version "1.0.0"
252+ And ClusterCatalog "test" is deleted
253+ When ClusterExtension is updated to change version
254+ """
255+ apiVersion: olm.operatorframework.io/v1
256+ kind: ClusterExtension
257+ metadata:
258+ name: ${NAME}
259+ spec:
260+ namespace: ${TEST_NAMESPACE}
261+ serviceAccount:
262+ name: olm-sa
263+ source:
264+ sourceType: Catalog
265+ catalog:
266+ packageName: test
267+ version: "1.0.1"
268+ selector:
269+ matchLabels:
270+ "olm.operatorframework.io/metadata.name": test-catalog
271+ """
272+ # Wait for reconciliation after the version change request
273+ And ClusterExtension reports Progressing as True with Reason Retrying
274+ # Verify upgrade did not proceed: version remains at 1.0.0 (not 1.0.1)
275+ Then bundle "test-operator.1.0.0" is installed in version "1.0.0"
276+ And ClusterExtension reports Installed as True
277+ # Note: Retrying status means controller will auto-upgrade when catalog becomes available
278+
279+ @BoxcutterRuntime
280+ Scenario : Extension with revisions continues running after catalog deletion
281+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
282+ And ClusterExtension is applied
283+ """
284+ apiVersion: olm.operatorframework.io/v1
285+ kind: ClusterExtension
286+ metadata:
287+ name: ${NAME}
288+ spec:
289+ namespace: ${TEST_NAMESPACE}
290+ serviceAccount:
291+ name: olm-sa
292+ source:
293+ sourceType: Catalog
294+ catalog:
295+ packageName: test
296+ selector:
297+ matchLabels:
298+ "olm.operatorframework.io/metadata.name": test-catalog
299+ """
300+ And ClusterExtension is rolled out
301+ And ClusterExtension is available
302+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
303+ And resource "deployment/test-operator" is available
304+ And ClusterCatalog "test" is deleted
305+ # Wait for reconciliation to complete after catalog deletion
306+ When ClusterExtension reports Installed as True
307+ Then resource "deployment/test-operator" is available
308+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
309+
310+ @BoxcutterRuntime
311+ Scenario : Revision remains available after catalog deletion
312+ Given ServiceAccount "olm-sa" with needed permissions is available in ${TEST_NAMESPACE}
313+ And ClusterExtension is applied
314+ """
315+ apiVersion: olm.operatorframework.io/v1
316+ kind: ClusterExtension
317+ metadata:
318+ name: ${NAME}
319+ spec:
320+ namespace: ${TEST_NAMESPACE}
321+ serviceAccount:
322+ name: olm-sa
323+ source:
324+ sourceType: Catalog
325+ catalog:
326+ packageName: test
327+ version: "1.2.0"
328+ selector:
329+ matchLabels:
330+ "olm.operatorframework.io/metadata.name": test-catalog
331+ """
332+ And ClusterExtension is rolled out
333+ And ClusterExtension is available
334+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
335+ And ClusterCatalog "test" is deleted
336+ # Catalog deletion should NOT affect workload availability
337+ # Wait for reconciliation to complete after catalog deletion
338+ When ClusterExtension reports Installed as True
339+ Then ClusterExtension is available
340+ And ClusterExtensionRevision "${NAME}-1" reports Available as True with Reason ProbesSucceeded
341+ And resource "deployment/test-operator" is available
0 commit comments