@@ -395,9 +395,7 @@ def update_ca_secret(ca_secret_item, cluster_name, namespace):
395395 data ["ca.key" ], data ["ca.crt" ] = generate_cert .generate_ca_cert (365 )
396396
397397
398- def enable_local_interactive (
399- resources , cluster_name , namespace , ingress_options , ingress_domain
400- ):
398+ def enable_local_interactive (resources , cluster_name , namespace , ingress_domain ):
401399 rayclient_ingress_item = resources ["resources" ].get ("GenericItems" )[2 ]
402400 ca_secret_item = resources ["resources" ].get ("GenericItems" )[3 ]
403401 item = resources ["resources" ].get ("GenericItems" )[0 ]
@@ -423,41 +421,23 @@ def enable_local_interactive(
423421
424422 command = command .replace ("deployment-name" , cluster_name )
425423
426- if ingress_options != {}:
427- for index , ingress_option in enumerate (ingress_options ["ingresses" ]):
428- if ingress_option ["port" ] == 10001 :
429- if "host" not in ingress_option .keys ():
430- raise ValueError (
431- f"Client host is not specified please include a host for the ingress item at index { index } "
432- )
433- else :
434- host = ingress_option ["host" ]
435- domain_split = host .split ("." , 1 )
436- if len (domain_split ) > 1 :
437- domain = domain_split [1 ]
438- else :
439- raise ValueError (
440- f"The client ingress host is configured incorrectly please specify a host with a correct domain for the ingress item at index { index } "
441- )
442-
443- else :
444- if is_openshift_cluster ():
445- # We can try get the domain through checking ingresses.config.openshift.io
446- try :
447- config_check ()
448- api_client = client .CustomObjectsApi (api_config_handler ())
449- ingress = api_client .get_cluster_custom_object (
450- "config.openshift.io" , "v1" , "ingresses" , "cluster"
451- )
452- except Exception as e : # pragma: no cover
453- return _kube_api_error_handling (e )
454- domain = ingress ["spec" ]["domain" ]
455- elif ingress_domain is None :
456- raise ValueError (
457- "ingress_domain is invalid. For Kubernetes Clusters please specify an ingress domain"
424+ if is_openshift_cluster ():
425+ # We can try get the domain through checking ingresses.config.openshift.io
426+ try :
427+ config_check ()
428+ api_client = client .CustomObjectsApi (api_config_handler ())
429+ ingress = api_client .get_cluster_custom_object (
430+ "config.openshift.io" , "v1" , "ingresses" , "cluster"
458431 )
459- else :
460- domain = ingress_domain
432+ except Exception as e : # pragma: no cover
433+ return _kube_api_error_handling (e )
434+ domain = ingress ["spec" ]["domain" ]
435+ elif ingress_domain is None :
436+ raise ValueError (
437+ "ingress_domain is invalid. For Kubernetes Clusters please specify an ingress domain"
438+ )
439+ else :
440+ domain = ingress_domain
461441
462442 command = command .replace ("server-name" , domain )
463443 update_rayclient_ingress (rayclient_ingress_item , cluster_name , namespace , domain )
0 commit comments