Skip to content

make osc login more userfriendly - #1869

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
deads2k:deads-change-login
Apr 23, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
deads2k:deads-change-login

Conversation

@deads2k

@deads2k deads2k commented Apr 22, 2015

Copy link
Copy Markdown
Contributor

Fixes #1854.
Fixes #1770.
Fixes bug https://bugzilla.redhat.com/show_bug.cgi?id=1208783.

This changes osc login to accept a server URL as an argument if it is provided. It also:

  1. allows the argument to be anything that makes a legal flagtype.Addr, so osc login localhost is valid.
  2. given a server, checks to see if there's already CA or ignore-tls information for this server in the kubeconfig file. This is convenient for logging into the same server with multiple identities. I don't have to keep getting prompted.
  3. given a server and username, checks to see if any of the tokens in the kubeconfig associated via context with that server correspond to the specified user and re-uses them if available. This makes logins with the different identities much more convenient. osc login -u admin switches my identity to admin if I have a user stanza associated with this server that gives back the user admin.
  4. osc login no longer attempts to use the current-context of the kubeconfig to see if you are already logged in.

@fabianofranz review?
@smarterclayton per your issue.

@fabianofranz

Copy link
Copy Markdown
Contributor

Remember that --server is still a persistent flag registered elsewhere, so although not advertised make sure osc login --server=<server> still works.

@deads2k

deads2k commented Apr 22, 2015

Copy link
Copy Markdown
Contributor Author

make sure osc login --server= still works.

Do we want it to? Why would we have two different ways of specifying the value?

@fabianofranz

Copy link
Copy Markdown
Contributor

We don't want to advertise it, but the flag will still be there anyway (and is shown if you do osc options). So I think it's better working than broken.

@fabianofranz

Copy link
Copy Markdown
Contributor

Not sure what flagtype.Addr uses to parse URLs, but if it's net/url there may be some issues. Make sure it accepts URLs like "example.com", "example.com:8443", "localhost:8443", "https://localhost", "localhost.localdomain:8443", etc.

@deads2k

deads2k commented Apr 22, 2015

Copy link
Copy Markdown
Contributor Author

We don't want to advertise it, but the flag will still be there anyway (and is shown if you do osc options). So I think it's better working than broken.

Ok. If both are set, would you prefer an error or one winning?

@fabianofranz

Copy link
Copy Markdown
Contributor

The same approach we use in other commands that support both arg and flag (I didn't check, but for example what happens if you provide a git repo to new-app using both an arg and --code).

Comment thread pkg/cmd/cli/cmd/login.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

certificate-authority is CAFile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nevermind, I got what you are doing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, that was a bug. Just a consistent one that I didn't catch because I didn't authenticate using client certs.

@fabianofranz

Copy link
Copy Markdown
Contributor

You may have fixed #1770 sir, please give it a try.

@fabianofranz

Copy link
Copy Markdown
Contributor

@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

The same approach we use in other commands that support both arg and flag (I didn't check, but for example what happens if you provide a git repo to new-app using both an arg and --code).

newapp does both. I think that will be confusing for login (priority chains were the bane of kubeconfig). I'll choose the argument as the winner.

@deads2k
deads2k force-pushed the deads-change-login branch from 1edc7de to 43a533b Compare April 23, 2015 12:36
@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

comments addressed.

@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

You may have fixed #1770
...and https://bugzilla.redhat.com/show_bug.cgi?id=1208783

Seems to. Added them to the description.

@smarterclayton

Copy link
Copy Markdown
Contributor

Flags are higher priority than args. If they conflict, error

On Apr 23, 2015, at 8:14 AM, David Eads [email protected] wrote:

The same approach we use in other commands that support both arg and flag (I didn't check, but for example what happens if you provide a git repo to new-app using both an arg and --code).

newapp does both. I think that will be confusing for login (priority chains were the bane of kubeconfig). I'll choose the argument as the winner.

—
Reply to this email directly or view it on GitHub.

@deads2k
deads2k force-pushed the deads-change-login branch from 43a533b to 067d434 Compare April 23, 2015 15:15
@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

added error on conflict.

@fabianofranz

Copy link
Copy Markdown
Contributor

LGTM

@deads2k
deads2k force-pushed the deads-change-login branch from 067d434 to fb5ee26 Compare April 23, 2015 15:28
@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_openshift3/1663/) (Image: devenv-fedora_1348)

@smarterclayton

Copy link
Copy Markdown
Contributor

You need to rebase

@smarterclayton

Copy link
Copy Markdown
Contributor

Merge cancelled.

@deads2k
deads2k force-pushed the deads-change-login branch from fb5ee26 to cc3fb8d Compare April 23, 2015 17:23
@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

@smarterclayton rebased and fixed up printlns. Do the other responses make sense?

@smarterclayton

Copy link
Copy Markdown
Contributor

LGTM, squash.

@deads2k
deads2k force-pushed the deads-change-login branch from cc3fb8d to 8b4ab0a Compare April 23, 2015 18:30
@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

squashed. [merge]

@deads2k
deads2k force-pushed the deads-change-login branch from 8b4ab0a to f62a1f2 Compare April 23, 2015 20:24
@deads2k

deads2k commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

[merge] ?

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin up to f62a1f2

openshift-bot pushed a commit that referenced this pull request Apr 23, 2015
@openshift-bot
openshift-bot merged commit 7c20ec3 into openshift:master Apr 23, 2015
@deads2k
deads2k deleted the deads-change-login branch June 11, 2015 14:18
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.

osc login should take a single argument if provided osc login with an existing invalid ca cert fails

4 participants