Skip to content
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

[RFE] oc CLI should preserve name of contexts #18645

Open
jorgemoralespou opened this issue Feb 16, 2018 · 13 comments
Open

[RFE] oc CLI should preserve name of contexts #18645

jorgemoralespou opened this issue Feb 16, 2018 · 13 comments
Labels
area/usability kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2 sig/master

Comments

@jorgemoralespou
Copy link

When working with OpenShift, it might happen that you connect to multiple clusters. These can be cloud clusters, on-premises, or even multiple profiles of minishift.
When you connect to a cluster, oc creates an entry for that context including cluster, user and namespace. These contexts that are created are given an automatic name by oc.

e.g.

default/console-cluster02-gce-pixy-io:8443/admin
default/127-0-0-1:8443/system:admin
devconfcz18/api-pro-us-east-1-openshift-com:443/[email protected]

These names are difficult to handle and remember.

Kubernetes does promote giving these contexts a meaningful name in their documentation. But when you follow those practices in OpenShift, you run into many issues, which are what this issue/RFE wants to solve.

  • Login into an openshift cluster via "oc login" creates entries in .kube/config even if they exist with different name
  • "oc new-project" creates entries in .kube/config even if they exist with different name instead of just changing the current context's namespace
  • "oc project" creates entries in .kube/config even if they exist with different name instead of just changing the current context's namespace
  • "oc delete project" does not remove the namespace from the current context's context (or set a default)
  • "oc logout" does not unset the "current-context" but only remove the token.

There's probably other things that make "oc" misbehave with respect to keeping a sane .kube/config file.

There's references in k8s to make enhancements on the usability:

As well as references in other projects of the problem I described:

This RFE is to fix the behavior the "oc" client has with respect to using/interacting with .kube/config file.

@jwforres
Copy link
Member

@openshift/sig-master

@juanvallejo
Copy link
Contributor

There is a related discussion about context management here: #16161 (comment)

cc @liggitt for thoughts on this

@openshift-bot
Copy link
Contributor

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 24, 2018
@jorgemoralespou
Copy link
Author

jorgemoralespou commented May 24, 2018 via email

@openshift-ci-robot openshift-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label May 24, 2018
@jorgemoralespou
Copy link
Author

@juanvallejo any update on this? This problem causes issues also in minishift minishift/minishift#2871

@juanvallejo
Copy link
Contributor

@jorgemoralespou As far as I can tell, this is not something that is being actively worked on. Existing oc commands, such as oc project depend on the current context-naming scheme (default/console-cluster02-gce-pixy-io:8443/admin).

I think broader agreement would have to be reached on this change first, as it would involve changes across multiple parts of oc.

cc @deads2k

@jorgemoralespou
Copy link
Author

@juanvallejo, maybe since we're looking at v4 this is a change we could accomplish and finally fix this long-standing bad behavior.
cc/ @smarterclayton

@soltysh
Copy link
Contributor

soltysh commented Oct 18, 2018

@jorgemoralespou the usability problems you're raising are fair and I think we should solve them, but I doubt the sheer volume of work around v4 will allow us to invest any time into oc, and I'm speaking as the owner of that component.

@jorgemoralespou
Copy link
Author

Does this mean a won't fix? From what understood in previous conversations this could only be looked if we ever went through a major release. This is the first in 3 years, and I don't expect another one sooner than that.
Is this something that could be fixed in minor releases? Meaning 4.1, or 4.2, or it won't happen at least until 5.0?

@soltysh
Copy link
Contributor

soltysh commented Oct 18, 2018

Does this mean a won't fix?

Nope, I didn't say that. What I said is that it won't happen for 4.0, but I'm not saying it can't nor it shouldn't be fixed in following releases. I don't see this being a breaking change, so it can be done at any point in time. Not sure who told you otherwise.

@jorgemoralespou
Copy link
Author

jorgemoralespou commented Oct 19, 2018 via email

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 13, 2019
@erszcz
Copy link

erszcz commented Sep 19, 2022

Looking forward to this happening 🤞

@thanosz
Copy link

thanosz commented Oct 15, 2023

Hello, any chance this gets revisited? @soltysh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/usability kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. priority/P2 sig/master
Projects
None yet
Development

No branches or pull requests

8 participants