@@ -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,7 @@ 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 , mcad = True , ingress_domain = None , ingress_options = {}, write_to_file = False , verify_tls = True
487
495
):
488
496
config_check ()
489
497
if (
@@ -543,6 +551,7 @@ def from_k8_cluster_object(
543
551
ingress_domain = ingress_domain ,
544
552
ingress_options = ingress_options ,
545
553
write_to_file = write_to_file ,
554
+ verify_tls = verify_tls ,
546
555
)
547
556
return Cluster (cluster_config )
548
557
@@ -627,7 +636,7 @@ def get_current_namespace(): # pragma: no cover
627
636
628
637
629
638
def get_cluster (
630
- cluster_name : str , namespace : str = "default" , write_to_file : bool = False
639
+ cluster_name : str , namespace : str = "default" , write_to_file : bool = False , verify_tls : bool = True
631
640
):
632
641
try :
633
642
config_check ()
@@ -701,6 +710,7 @@ def get_cluster(
701
710
ingress_domain = ingress_domain ,
702
711
ingress_options = ingress_options ,
703
712
write_to_file = write_to_file ,
713
+ verify_tls = verify_tls ,
704
714
)
705
715
raise FileNotFoundError (
706
716
f"Cluster { cluster_name } is not found in { namespace } namespace"
0 commit comments