Skip to content

Remove hard-coded port 6443 in auth #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/codeflare_sdk/cluster/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def login(self) -> str:
Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
to `True`.
"""
args = [f"--token={self.token}", f"--server={self.server}:6443"]
args = [f"--token={self.token}", f"--server={self.server}"]
if self.skip_tls:
args.append("--insecure-skip-tls-verify")
try:
Expand All @@ -84,7 +84,7 @@ def logout(self) -> str:
"""
This function is used to logout of an OpenShift cluster.
"""
args = [f"--token={self.token}", f"--server={self.server}:6443"]
args = [f"--token={self.token}", f"--server={self.server}"]
response = oc.invoke("logout", args)
return response.out()

Expand Down
4 changes: 2 additions & 2 deletions tests/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_token_auth_login_logout(mocker):
mock_res = mocker.patch.object(openshift.Result, "out")
mock_res.side_effect = lambda: att_side_effect(fake_res)

token_auth = TokenAuthentication(token="testtoken", server="testserver")
token_auth = TokenAuthentication(token="testtoken", server="testserver:6443")
assert token_auth.login() == (
"login",
["--token=testtoken", "--server=testserver:6443"],
Expand All @@ -137,7 +137,7 @@ def test_token_auth_login_tls(mocker):
# assert token_auth.login() == "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"

token_auth = TokenAuthentication(
token="testtoken", server="testserver", skip_tls=True
token="testtoken", server="testserver:6443", skip_tls=True
)
assert token_auth.login() == (
"login",
Expand Down