@@ -506,14 +506,23 @@ def from_k8_cluster_object(
506506 rc , mcad = True , ingress_domain = None , ingress_options = {}, write_to_file = False
507507 ):
508508 config_check ()
509+ openshift_oauth = False
509510 if (
510511 rc ["metadata" ]["annotations" ]["sdk.codeflare.dev/local_interactive" ]
511512 == "true"
512513 ):
513514 local_interactive = True
514515 else :
515516 local_interactive = False
516-
517+ if "codeflare.dev/oauth" in rc ["metadata" ]["annotations" ]:
518+ if rc ["metadata" ]["annotations" ]["codeflare.dev/oauth" ] == "True" :
519+ openshift_oauth = True
520+ else :
521+ for container in rc ["spec" ]["headGroupSpec" ]["template" ]["spec" ][
522+ "containers"
523+ ]:
524+ if "oauth-proxy" in container ["name" ]:
525+ openshift_oauth = True
517526 machine_types = (
518527 rc ["metadata" ]["labels" ]["orderedinstance" ].split ("_" )
519528 if "orderedinstance" in rc ["metadata" ]["labels" ]
@@ -530,12 +539,16 @@ def from_k8_cluster_object(
530539 namespace = rc ["metadata" ]["namespace" ],
531540 machine_types = machine_types ,
532541 num_workers = rc ["spec" ]["workerGroupSpecs" ][0 ]["minReplicas" ],
533- min_cpus = rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ][
534- "containers"
535- ][0 ]["resources" ]["requests" ]["cpu" ],
536- max_cpus = rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ][
537- "containers"
538- ][0 ]["resources" ]["limits" ]["cpu" ],
542+ min_cpus = int (
543+ rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][0 ][
544+ "resources"
545+ ]["requests" ]["cpu" ]
546+ ),
547+ max_cpus = int (
548+ rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][0 ][
549+ "resources"
550+ ]["limits" ]["cpu" ]
551+ ),
539552 min_memory = int (
540553 rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][0 ][
541554 "resources"
@@ -546,9 +559,11 @@ def from_k8_cluster_object(
546559 "resources"
547560 ]["limits" ]["memory" ][:- 1 ]
548561 ),
549- num_gpus = rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ][
550- "containers"
551- ][0 ]["resources" ]["limits" ]["nvidia.com/gpu" ],
562+ num_gpus = int (
563+ rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][0 ][
564+ "resources"
565+ ]["limits" ]["nvidia.com/gpu" ]
566+ ),
552567 instascale = True if machine_types else False ,
553568 image = rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][
554569 0
@@ -558,6 +573,7 @@ def from_k8_cluster_object(
558573 ingress_domain = ingress_domain ,
559574 ingress_options = ingress_options ,
560575 write_to_file = write_to_file ,
576+ openshift_oauth = openshift_oauth ,
561577 )
562578 return Cluster (cluster_config )
563579
0 commit comments