@@ -182,21 +182,28 @@ def install_operator(
182
182
)
183
183
184
184
185
- def uninstall_operator (admin_client , name , timeout = TIMEOUT_30MIN ):
185
+ def uninstall_operator (
186
+ admin_client ,
187
+ name ,
188
+ timeout = TIMEOUT_30MIN ,
189
+ operator_namespace = None ,
190
+ ):
186
191
"""
187
192
Uninstall operator on cluster.
188
193
189
194
Args:
190
195
admin_client (DynamicClient): Cluster client.
191
196
name (str): Name of the operator to uninstall.
192
197
timeout (int): Timeout in seconds to wait for operator to be uninstalled.
198
+ operator_namespace (str, optional): Operator namespace, if not provided, operator name will be used
193
199
"""
194
200
195
201
csv_name = None
202
+ operator_namespace = operator_namespace or name
196
203
subscription = Subscription (
197
204
client = admin_client ,
198
205
name = name ,
199
- namespace = name ,
206
+ namespace = operator_namespace ,
200
207
)
201
208
if subscription .exists :
202
209
csv_name = subscription .instance .status .installedCSV
@@ -205,13 +212,13 @@ def uninstall_operator(admin_client, name, timeout=TIMEOUT_30MIN):
205
212
OperatorGroup (
206
213
client = admin_client ,
207
214
name = name ,
208
- namespace = name ,
215
+ namespace = operator_namespace ,
209
216
).clean_up ()
210
217
211
218
for _operator in Operator .get (dyn_client = admin_client ):
212
219
if _operator .name .startswith (name ):
213
220
# operator name convention is <name>.<namespace>
214
- namespace = name .split ("." )[- 1 ]
221
+ namespace = operator_namespace or name .split ("." )[- 1 ]
215
222
ns = Namespace (client = admin_client , name = namespace )
216
223
if ns .exists :
217
224
ns .clean_up ()
0 commit comments