-
Notifications
You must be signed in to change notification settings - Fork 53
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
CLI Authentication #252
Conversation
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 😁) |
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.
LGTM! Can confirm login and logout work as they should and tests pass nice work Carson
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.
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
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.
LGTM
* 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
* 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
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
andcodeflare logout
are the two functions to be tested. Can be run in the terminal after building SDK withpip install -e .
pytest -v tests/unit_test.py
orpython -m pytest tests/unit_test.py
Checks