@@ -506,14 +506,23 @@ def from_k8_cluster_object(
506
506
rc , mcad = True , ingress_domain = None , ingress_options = {}, write_to_file = False
507
507
):
508
508
config_check ()
509
+ openshift_oauth = False
509
510
if (
510
511
rc ["metadata" ]["annotations" ]["sdk.codeflare.dev/local_interactive" ]
511
512
== "true"
512
513
):
513
514
local_interactive = True
514
515
else :
515
516
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
517
526
machine_types = (
518
527
rc ["metadata" ]["labels" ]["orderedinstance" ].split ("_" )
519
528
if "orderedinstance" in rc ["metadata" ]["labels" ]
@@ -530,12 +539,16 @@ def from_k8_cluster_object(
530
539
namespace = rc ["metadata" ]["namespace" ],
531
540
machine_types = machine_types ,
532
541
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
+ ),
539
552
min_memory = int (
540
553
rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][0 ][
541
554
"resources"
@@ -546,9 +559,11 @@ def from_k8_cluster_object(
546
559
"resources"
547
560
]["limits" ]["memory" ][:- 1 ]
548
561
),
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
+ ),
552
567
instascale = True if machine_types else False ,
553
568
image = rc ["spec" ]["workerGroupSpecs" ][0 ]["template" ]["spec" ]["containers" ][
554
569
0
@@ -558,6 +573,7 @@ def from_k8_cluster_object(
558
573
ingress_domain = ingress_domain ,
559
574
ingress_options = ingress_options ,
560
575
write_to_file = write_to_file ,
576
+ openshift_oauth = openshift_oauth ,
561
577
)
562
578
return Cluster (cluster_config )
563
579
0 commit comments