Skip to content

CLI Authentication #252

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 10 commits into from
Jul 31, 2023
Merged

CLI Authentication #252

merged 10 commits into from
Jul 31, 2023

Conversation

carsonmh
Copy link
Contributor

Issue link

closes #217

What changes have been made

Made login and logout functions in the CLI, allowing the user to authenticate into their Kubernetes cluster using token + server. Also added load_auth function which loads the authentication configuration so the SDK can use it.

Verification steps

  • codeflare login and codeflare logout are the two functions to be tested. Can be run in the terminal after building SDK with pip install -e .
  • Unit tests can be run in usual way with pytest -v tests/unit_test.py or python -m pytest tests/unit_test.py

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@Maxusmusti
Copy link
Collaborator

Maxusmusti commented Jul 27, 2023

This would be a good one for @Bobbins228 to review as well, as he's pretty familiar with the new auth updates (being the one who wrote them 😁)

@Maxusmusti Maxusmusti requested a review from Bobbins228 July 27, 2023 18:40
Copy link
Contributor

@Bobbins228 Bobbins228 left a comment

Choose a reason for hiding this comment

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

LGTM! Can confirm login and logout work as they should and tests pass nice work Carson

Copy link
Collaborator

@Maxusmusti Maxusmusti left a comment

Choose a reason for hiding this comment

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

Put this in slack, but adding this here as well so nobody accidentally merges without seeing:

Looks good, just a couple of things:

  • When things are saved in "auth", that's an actual file getting created and stored, right? If so, be careful about using a relative path, as people may login, move to a different dir, then be confused as to why they are logged out. We may instead want this file to be in a set ~/.codeflare/auth
  • In your unit tests, it may be worth checking that the contents of the auth file are as you expect as well
  • Just checking, where is the load_auth() function going to be used, is it going to be at the start of every other CLI function?
  • I'm assuming this is just for token auth? That makes sense, as users can otherwise just do their own export KUBECONFIG=... if they need to change default kubeconfig path. I would just test and make sure that that option still works as expected

@carsonmh carsonmh requested a review from Maxusmusti July 28, 2023 22:02
Copy link
Collaborator

@Maxusmusti Maxusmusti left a comment

Choose a reason for hiding this comment

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

LGTM

@Maxusmusti Maxusmusti merged commit 346452a into project-codeflare:cli-update Jul 31, 2023
Maxusmusti pushed a commit that referenced this pull request Jul 31, 2023
* Add: create_api_client_config helper function for the SDK

* Add: login function for CLI

* Change: change options and help for login function

* Create: logout function

* Test: add unit tests for login and logout functions

* add: additional error handling and change layout slightly

* test: add unit test for load_auth

* change: make tls skip false by default

* add: make authentication go into .codeflare

* test: add unit tests for checking validity of auth file and split login/logout tests
carsonmh added a commit that referenced this pull request Aug 11, 2023
* Add: create_api_client_config helper function for the SDK

* Add: login function for CLI

* Change: change options and help for login function

* Create: logout function

* Test: add unit tests for login and logout functions

* add: additional error handling and change layout slightly

* test: add unit test for load_auth

* change: make tls skip false by default

* add: make authentication go into .codeflare

* test: add unit tests for checking validity of auth file and split login/logout tests
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.

3 participants