Skip to content

Commit a9f14f9

Browse files
szaheropenshift-merge-bot[bot]
authored andcommitted
feat(auth): verify API client connectivity in set_api_client
Add an authentication check when setting a custom API client to catch misconfigured or invalid clients early. The verification calls AuthenticationApi.get_api_group() to confirm the client can reach the Kubernetes API server before proceeding. Signed-off-by: Saad Zaher <szaher@redhat.com>
1 parent e5cdf08 commit a9f14f9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • src/codeflare_sdk/common/kubernetes_cluster

src/codeflare_sdk/common/kubernetes_cluster/auth.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,7 @@ def set_api_client(new_client: client.ApiClient):
358358
global api_client, config_path
359359
api_client = new_client
360360
config_path = "custom" # Mark as configured with custom client
361+
# verify the client works by making a simple API call
362+
client.AuthenticationApi(api_client).get_api_group()
363+
# print message confirming successful configuration
364+
print("Custom API client has been set and verified successfully.")

0 commit comments

Comments
 (0)