Skip to content

Add support for specifying a cluster CA certificate to the sdk #164

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

Closed
wants to merge 1 commit into from

Conversation

Bobbins228
Copy link
Contributor

@Bobbins228 Bobbins228 commented Jun 19, 2023

Linked to issue #161
By setting skip_tls=False the login command will use the arg --certificate-authority with the specified path to a cert a user sets with ca_cert_path

Example:

# Create authentication object for oc user permissions
auth = TokenAuthentication(
    token = "XXXXX",
    server = "XXXXX",
    ca_cert_path = "<path-to-cert.crt>"
)
auth.login()

Copy link
Member

@tedhtchang tedhtchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bobbins228 Thanks. Looks good. Could you provide an example how to test/verify this PR ?

@Bobbins228
Copy link
Contributor Author

@Bobbins228 Thanks. Looks good. Could you provide an example how to test/verify this PR ?

Hi Ted,

To begin clone this repo and checkout the add-ca-support branch.
Use poetry build to create a new whl file located in the dist folder.
On a Jupytr notebook drag the whl file to your working directory and install it with !pip install <whl-file>.whl.

import the library with

from codeflare_sdk.cluster.cluster import Cluster, ClusterConfiguration
from codeflare_sdk.cluster.auth import TokenAuthentication

In another cell log in using...

auth = TokenAuthentication(
    token = "XXXXX",
    server = "XXXXX",
    skip_tls=False,
    ca_cert_path="<path>"
)
auth.login()

While testing this out I found that the the Jupytr Notebook pod has a trusted cert bundle located at /etc/pki/tls/certs/ca-bundle.crt.
I could set this as the default path value instead of the None I have already.

Another thing I noticed while testing is that with my work in place you can no longer log in with just token and server unless skip_tls=True. Is this okay?

When you try to log in without specifying a path with skip_tls=False you get this 'error: open None: no such file or directory\n'. We could set the default path to the default cert path mentioned above to mitigate this.

@Bobbins228
Copy link
Contributor Author

Closing this as we have moved towards using the Kubernetes api. See #186

@Bobbins228 Bobbins228 closed this Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants