diff --git a/docs/cluster/auth.html b/docs/cluster/auth.html index f3fc2b752..01538a024 100644 --- a/docs/cluster/auth.html +++ b/docs/cluster/auth.html @@ -54,6 +54,7 @@
codeflare_sdk.cluster.auth
codeflare_sdk.cluster.auth
codeflare_sdk.cluster.auth
class TokenAuthentication
-(token: str = None, server: str = None)
+(token: str = None, server: str = None, skip_tls: bool = False)
TokenAuthentication
is a subclass of Authentication
. It can be used to authenticate to an OpenShift
@@ -328,11 +336,7 @@
This function is used to login to an OpenShift cluster using the user's API token and API server address.
This function is used to login to an OpenShift cluster using the user's API token and API server address.
+Depending on the cluster, a user can choose to login in with "–insecure-skip-tls-verify by setting
skip_tls`
+to True
.
def login(self):
"""
This function is used to login to an OpenShift cluster using the user's API token and API server address.
+ Depending on the cluster, a user can choose to login in with "--insecure-skip-tls-verify` by setting `skip_tls`
+ to `True`.
"""
- token = self.token
- server = self.server
- response = oc.invoke("login", [f"--token={token}", f"--server={server}:6443"])
+ args = [f"--token={self.token}", f"--server={self.server}:6443"]
+ if self.skip_tls:
+ args.append("--insecure-skip-tls-verify")
+ try:
+ response = oc.invoke("login", args)
+ except OpenShiftPythonException as osp:
+ error_msg = osp.result.err()
+ if "The server uses a certificate signed by unknown authority" in error_msg:
+ return "Error: certificate auth failure, please set `skip_tls=True` in TokenAuthentication"
+ else:
+ return error_msg
return response.out()