@@ -81,6 +81,12 @@ def _client_headers(self):
81
81
)
82
82
}
83
83
84
+ @property
85
+ def _client_verify_tls (self ):
86
+ if not is_openshift_cluster or not self .config .verify_tls :
87
+ return False
88
+ return True
89
+
84
90
@property
85
91
def job_client (self ):
86
92
k8client = api_config_handler () or client .ApiClient ()
@@ -91,7 +97,7 @@ def job_client(self):
91
97
self ._job_submission_client = JobSubmissionClient (
92
98
self .cluster_dashboard_uri (),
93
99
headers = self ._client_headers ,
94
- verify = False ,
100
+ verify = self . _client_verify_tls ,
95
101
)
96
102
else :
97
103
self ._job_submission_client = JobSubmissionClient (
@@ -184,6 +190,7 @@ def create_app_wrapper(self):
184
190
ingress_domain = self .config .ingress_domain
185
191
ingress_options = self .config .ingress_options
186
192
write_to_file = self .config .write_to_file
193
+ verify_tls = self .config .verify_tls
187
194
return generate_appwrapper (
188
195
name = name ,
189
196
namespace = namespace ,
@@ -209,6 +216,7 @@ def create_app_wrapper(self):
209
216
ingress_domain = ingress_domain ,
210
217
ingress_options = ingress_options ,
211
218
write_to_file = write_to_file ,
219
+ verify_tls = verify_tls ,
212
220
)
213
221
214
222
# creates a new cluster with the provided or default spec
@@ -346,7 +354,7 @@ def is_dashboard_ready(self) -> bool:
346
354
self .cluster_dashboard_uri (),
347
355
headers = self ._client_headers ,
348
356
timeout = 5 ,
349
- verify = False ,
357
+ verify = self . _client_verify_tls ,
350
358
)
351
359
except requests .exceptions .SSLError : # pragma no cover
352
360
# SSL exception occurs when oauth ingress has been created but cluster is not up
@@ -483,7 +491,12 @@ def torchx_config(
483
491
return to_return
484
492
485
493
def from_k8_cluster_object (
486
- rc , mcad = True , ingress_domain = None , ingress_options = {}, write_to_file = False
494
+ rc ,
495
+ mcad = True ,
496
+ ingress_domain = None ,
497
+ ingress_options = {},
498
+ write_to_file = False ,
499
+ verify_tls = True ,
487
500
):
488
501
config_check ()
489
502
if (
@@ -543,6 +556,7 @@ def from_k8_cluster_object(
543
556
ingress_domain = ingress_domain ,
544
557
ingress_options = ingress_options ,
545
558
write_to_file = write_to_file ,
559
+ verify_tls = verify_tls ,
546
560
)
547
561
return Cluster (cluster_config )
548
562
@@ -627,7 +641,10 @@ def get_current_namespace(): # pragma: no cover
627
641
628
642
629
643
def get_cluster (
630
- cluster_name : str , namespace : str = "default" , write_to_file : bool = False
644
+ cluster_name : str ,
645
+ namespace : str = "default" ,
646
+ write_to_file : bool = False ,
647
+ verify_tls : bool = True ,
631
648
):
632
649
try :
633
650
config_check ()
@@ -701,6 +718,7 @@ def get_cluster(
701
718
ingress_domain = ingress_domain ,
702
719
ingress_options = ingress_options ,
703
720
write_to_file = write_to_file ,
721
+ verify_tls = verify_tls ,
704
722
)
705
723
raise FileNotFoundError (
706
724
f"Cluster { cluster_name } is not found in { namespace } namespace"
0 commit comments