File tree 4 files changed +8
-9
lines changed
src/codeflare_sdk/cluster
4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ def login(self) -> str:
74
74
error_msg = osp .result .err ()
75
75
if "The server uses a certificate signed by unknown authority" in error_msg :
76
76
return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
77
+ elif "invalid" in error_msg :
78
+ raise PermissionError (error_msg )
77
79
else :
78
80
return error_msg
79
81
return response .out ()
@@ -82,7 +84,8 @@ def logout(self) -> str:
82
84
"""
83
85
This function is used to logout of an OpenShift cluster.
84
86
"""
85
- response = oc .invoke ("logout" )
87
+ args = [f"--token={ self .token } " , f"--server={ self .server } :6443" ]
88
+ response = oc .invoke ("logout" , args )
86
89
return response .out ()
87
90
88
91
Original file line number Diff line number Diff line change @@ -96,9 +96,6 @@ def up(self):
96
96
Applies the AppWrapper yaml, pushing the resource request onto
97
97
the MCAD queue.
98
98
"""
99
- resp = self .config .auth .login ()
100
- if "invalid" in resp :
101
- raise PermissionError (resp )
102
99
namespace = self .config .namespace
103
100
try :
104
101
with oc .project (namespace ):
@@ -135,7 +132,6 @@ def down(self):
135
132
print ("Cluster not found, have you run cluster.up() yet?" )
136
133
else :
137
134
raise osp
138
- self .config .auth .logout ()
139
135
140
136
def status (
141
137
self , print_to_console : bool = True
Original file line number Diff line number Diff line change @@ -47,4 +47,3 @@ class ClusterConfiguration:
47
47
instascale : bool = False
48
48
envs : dict = field (default_factory = dict )
49
49
image : str = "ghcr.io/foundation-model-stack/base:ray2.1.0-py38-gpu-pytorch1.12.0cu116-20221213-193103"
50
- auth : Authentication = Authentication ()
Original file line number Diff line number Diff line change @@ -121,7 +121,10 @@ def test_token_auth_login_logout(mocker):
121
121
"login" ,
122
122
["--token=testtoken" , "--server=testserver:6443" ],
123
123
)
124
- assert token_auth .logout () == ("logout" ,)
124
+ assert token_auth .logout () == (
125
+ "logout" ,
126
+ ["--token=testtoken" , "--server=testserver:6443" ],
127
+ )
125
128
126
129
127
130
def test_token_auth_login_tls (mocker ):
@@ -198,7 +201,6 @@ def test_config_creation():
198
201
gpu = 7 ,
199
202
instascale = True ,
200
203
machine_types = ["cpu.small" , "gpu.large" ],
201
- auth = TokenAuthentication (token = "testtoken" , server = "testserver" ),
202
204
)
203
205
204
206
assert config .name == "unit-test-cluster" and config .namespace == "ns"
@@ -213,7 +215,6 @@ def test_config_creation():
213
215
assert config .template == f"{ parent } /src/codeflare_sdk/templates/new-template.yaml"
214
216
assert config .instascale
215
217
assert config .machine_types == ["cpu.small" , "gpu.large" ]
216
- assert config .auth .__class__ == TokenAuthentication
217
218
return config
218
219
219
220
You can’t perform that action at this time.
0 commit comments