-
Notifications
You must be signed in to change notification settings - Fork 51
Made ODH cert default cert for Token Auth #489
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
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Whats the status of this PR? it looks like the PR with which it depends (kubeflow) on has been merged. |
Kubeflow PR is in this is good to merge after a review and yeah pretty sure it's needed for disconnected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice changes, should make things much smoother!
src/codeflare_sdk/cluster/auth.py
Outdated
@@ -101,12 +101,16 @@ def login(self) -> str: | |||
""" | |||
global config_path | |||
global api_client | |||
odh_ca_path = "/etc/pki/tls/custom-certs/ca-bundle.crt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this into __init__
and set self.ca_cert_path
directly? and also allow the default path to be configurable via an environment variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are some great suggestions I'll make those changes
05c1f7f
to
fb25d70
Compare
src/codeflare_sdk/cluster/auth.py
Outdated
@@ -106,10 +106,24 @@ def login(self) -> str: | |||
configuration.api_key_prefix["authorization"] = "Bearer" | |||
configuration.host = self.server | |||
configuration.api_key["authorization"] = self.token | |||
if self.skip_tls == False and self.ca_cert_path == None: | |||
ca_path_env = os.environ.get("CA_CERT_PATH") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.environ.get("CF_SDK_CA_CERT_PATH", ca_path_env)
os.environ.get allows defaulting which can be used here. We should also prefix env vars WDYT of CF_SDK_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. I should also update the documentation in this PR too
see #544 |
Issue link
RHOAIENG-52, RHOAIENG-4375
What changes have been made
For
TokenAuthentication
the SDK will use the cert injected into a ODH/RHOAI Notebook by default in the/etc/pki/tls/custom-certs/ca-bundle.crt
locationVerification steps
Setup
Required steps for ODH/RHOAI
/etc/pki/tls/custom-certs/ca-bundle.crt
exists in the notebook.Notebook server ODH
git clone https://github.com/project-codeflare/codeflare-sdk.git
poetry build
- install if needed (pip install poetry
)pip install --force-reinstall dist/codeflare_sdk-0.0.0.dev0-py3-none-any.whl
Testing
Authenticate with
TokenAuthentication
.Set the environment variable
CA_CERT_PATH
to the path to your cert before authenticatingYou should receive the message
Authenticated with certificate located at /etc/pki/tls/custom-certs/ca-bundle.crt
You should be able to run through any demo notebook.
Checks