Bug 1419857 - oc login ignores --cluster and --context options [NEEDINFO]
Summary: oc login ignores --cluster and --context options
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Juan Vallejo
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-07 09:07 UTC by Aleksandar Kostadinov
Modified: 2017-10-25 21:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-10-25 19:11:13 UTC
Target Upstream Version:
jvallejo: needinfo? (jliggitt)


Attachments (Terms of Use)

Description Aleksandar Kostadinov 2017-02-07 09:07:29 UTC
Description of problem:
When performing `oc login` the options --cluster and --context are ignored. One has to first do `oc config use-context` and then `oc login`. Once logged it, the cluster and context options work for other commands.

I think this is inconsistent and inconvenient.

As a user I'd expect to be able to perform `oc login` with one of those commands. Then default context should be changed to the one used for login. Or even if default context is not switched, then that would be better than having to switch contexts just to be able to login.

Version-Release number of selected component (if applicable):
3.4.1.2

How reproducible:
always

Steps to Reproduce:
1. setup ~/.kube/config with 2 clusters
2. oc login --context=not-current-context


Actual results:
login is performed against current context instead of the specified context on command line

Expected results:
login is performed against the server/context specified on command line

Comment 1 Juan Vallejo 2017-02-07 23:49:48 UTC
Related PR: https://github.com/openshift/origin/pull/12859

Comment 2 Juan Vallejo 2017-10-25 19:11:13 UTC
Per Jordan's comment here [1], commands such as `oc project` are meant to be used to address the case of a user wanting to switch to a different context / cluster.

It is not the intent of `oc login` to allow the user to manually manage contexts.

1. https://github.com/openshift/origin/pull/12859#issuecomment-278851380

Comment 3 Aleksandar Kostadinov 2017-10-25 20:57:03 UTC
Any reason to not make it easier for the user to actually use different clusters/contexts?

As a user of multiple environments I can tell you that it is a great PITA to do so. I need to remember cluster hostname, project and username I'm using on each cluster. With the ability to have shorter mnemonic contexts, it is much more manageable.

That's why I filed the original bugzilla - because I find it hardly usable.

I don't care whether the tool was originally meant to allow certain usage. I'm proposing to make it more useful for multi-cluster use cases based on my experience using that tool. It is disappointing to see the request closed without a logical reason why it is a bad idea. Moreover there is a related pull request already.


Note You need to log in before you can comment on or make changes to this bug.