Skip to content

Commit 0ce4e49

Browse files
dbasunagjstourac
authored andcommitted
Use client instead of dyn_client in wrapper resource get calls
1 parent 7b8d4cd commit 0ce4e49

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ def fail_if_missing_dependent_operators(admin_client: DynamicClient) -> None:
513513
for operator_name in dependent_operators.split(","):
514514
csvs = list(
515515
ClusterServiceVersion.get(
516-
dyn_client=admin_client,
516+
client=admin_client,
517517
namespace=py_config["applications_namespace"],
518518
)
519519
)

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def _decode_split_data(_data: str) -> list[str]:
357357

358358
if users_Secret := list(
359359
Secret.get(
360-
dyn_client=admin_client,
360+
client=admin_client,
361361
name=secret_name,
362362
namespace=secret_ns,
363363
)
@@ -635,7 +635,7 @@ def minio_data_connection(
635635

636636
@pytest.fixture(scope="session")
637637
def nodes(admin_client: DynamicClient) -> Generator[list[Node], Any, Any]:
638-
yield list(Node.get(dyn_client=admin_client))
638+
yield list(Node.get(client=admin_client))
639639

640640

641641
@pytest.fixture(scope="session")

utilities/general.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def wait_for_pods_by_labels(
250250
"""
251251
pods = list(
252252
Pod.get(
253-
dyn_client=admin_client,
253+
client=admin_client,
254254
namespace=namespace,
255255
label_selector=label_selector,
256256
)
@@ -448,7 +448,7 @@ def wait_for_pods_running(
448448
wait_timeout=180,
449449
sleep=5,
450450
func=get_not_running_pods,
451-
pods=list(Pod.get(dyn_client=admin_client, namespace=namespace_name)),
451+
pods=list(Pod.get(client=admin_client, namespace=namespace_name)),
452452
exceptions_dict={NotFoundError: [], ResourceNotFoundError: []},
453453
)
454454
sample = None

utilities/inference_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def create_isvc(
746746
if wait and not stop_resume:
747747
# Modelmesh 2nd server in the ns will fail to be Ready; isvc needs to be re-applied
748748
if deployment_mode == KServeDeploymentType.MODEL_MESH:
749-
for isvc in InferenceService.get(dyn_client=client, namespace=namespace):
749+
for isvc in InferenceService.get(client=client, namespace=namespace):
750750
_runtime = get_inference_serving_runtime(isvc=isvc)
751751
isvc_annotations = isvc.instance.metadata.annotations
752752
if (

utilities/infra.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def wait_for_inference_deployment_replicas(
252252
exceptions_dict=DEFAULT_CLUSTER_RETRY_EXCEPTIONS,
253253
func=Deployment.get,
254254
label_selector=label_selector,
255-
dyn_client=client,
255+
client=client,
256256
namespace=ns,
257257
):
258258
deployment_list = list(deployments)
@@ -535,7 +535,7 @@ def get_services_by_isvc_label(
535535
if svcs := [
536536
svc
537537
for svc in Service.get(
538-
dyn_client=client,
538+
client=client,
539539
namespace=isvc.namespace,
540540
label_selector=label_selector,
541541
)
@@ -562,7 +562,7 @@ def get_pods_by_ig_label(client: DynamicClient, ig: InferenceGraph) -> list[Pod]
562562
if pods := [
563563
pod
564564
for pod in Pod.get(
565-
dyn_client=client,
565+
client=client,
566566
namespace=ig.namespace,
567567
label_selector=label_selector,
568568
)
@@ -592,7 +592,7 @@ def get_pods_by_isvc_label(client: DynamicClient, isvc: InferenceService, runtim
592592
if pods := [
593593
pod
594594
for pod in Pod.get(
595-
dyn_client=client,
595+
client=client,
596596
namespace=isvc.namespace,
597597
label_selector=label_selector,
598598
)
@@ -687,7 +687,7 @@ def get_model_route(client: DynamicClient, isvc: InferenceService) -> Route:
687687
if routes := [
688688
route
689689
for route in Route.get(
690-
dyn_client=client,
690+
client=client,
691691
namespace=isvc.namespace,
692692
label_selector=f"inferenceservice-name={isvc.name}",
693693
)
@@ -869,7 +869,7 @@ def get_product_version(admin_client: DynamicClient) -> Version:
869869
870870
"""
871871
operator_version: str = ""
872-
for csv in ClusterServiceVersion.get(dyn_client=admin_client, namespace=py_config["applications_namespace"]):
872+
for csv in ClusterServiceVersion.get(client=admin_client, namespace=py_config["applications_namespace"]):
873873
if re.match("rhods|opendatahub", csv.name):
874874
operator_version = csv.instance.spec.version
875875
break
@@ -981,7 +981,7 @@ def wait_for_serverless_pods_deletion(resource: Project | Namespace, admin_clien
981981
982982
"""
983983
client = admin_client or get_client()
984-
for pod in Pod.get(dyn_client=client, namespace=resource.name):
984+
for pod in Pod.get(client=client, namespace=resource.name):
985985
try:
986986
if (
987987
pod.exists
@@ -1020,7 +1020,7 @@ def wait_for_isvc_pods(client: DynamicClient, isvc: InferenceService, runtime_na
10201020

10211021

10221022
def get_rhods_subscription() -> Subscription | None:
1023-
subscriptions = Subscription.get(dyn_client=get_client(), namespace=RHOAI_OPERATOR_NAMESPACE)
1023+
subscriptions = Subscription.get(client=get_client(), namespace=RHOAI_OPERATOR_NAMESPACE)
10241024
if subscriptions:
10251025
for subscription in subscriptions:
10261026
LOGGER.info(f"Checking subscription {subscription.name}")

utilities/jira.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def is_jira_open(jira_id: str, admin_client: DynamicClient) -> bool:
5959
raise ValueError(f"Jira {jira_id}: status is {jira_status} but does not have fix version(s)")
6060

6161
operator_version: str = ""
62-
for csv in ClusterServiceVersion.get(dyn_client=admin_client, namespace=py_config["applications_namespace"]):
62+
for csv in ClusterServiceVersion.get(client=admin_client, namespace=py_config["applications_namespace"]):
6363
if re.match("rhods|opendatahub", csv.name):
6464
operator_version = csv.instance.spec.version
6565
break

utilities/kueue_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def check_gated_pods_and_running_pods(
155155
Pod.get(
156156
label_selector=",".join(labels),
157157
namespace=namespace,
158-
dyn_client=admin_client,
158+
client=admin_client,
159159
)
160160
)
161161
for pod in pods:

utilities/operator_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def get_cluster_service_version(client: DynamicClient, prefix: str, namespace: str) -> ClusterServiceVersion:
15-
csvs = ClusterServiceVersion.get(dyn_client=client, namespace=namespace)
15+
csvs = ClusterServiceVersion.get(client=client, namespace=namespace)
1616
LOGGER.info(f"Looking for {prefix} CSV in namespace {namespace}")
1717
matching_csvs = [csv for csv in csvs if csv.name.startswith(prefix)]
1818

0 commit comments

Comments
 (0)