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

Feature Request - add profile listing command #1716

Closed
darkowlzz opened this issue Jul 20, 2017 · 9 comments
Closed

Feature Request - add profile listing command #1716

darkowlzz opened this issue Jul 20, 2017 · 9 comments
Labels
area/profiles issues related to profile handling help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. 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. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. r/2019q2 Issue was last reviewed 2019q2

Comments

@darkowlzz
Copy link
Contributor

darkowlzz commented Jul 20, 2017

FEATURE REQUEST :

Minikube version: v0.20.0

minikube doesn't tracks profiles right now. It would be great to track the existing profiles and be able to list them. Maybe the profile command can be changed to have ls and set subcommands to list and set current profile.

I felt the need for a list of profiles when I came across #1683. While deleting machine, profile/machine name could be passed. From my observation, machine name and profile names are the same. Ability to list the existing profiles would be helpful in this case.

@r2d4 r2d4 added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 20, 2017
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

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

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 1, 2018
@mradmila
Copy link

Any plans to support this?

@r2d4
Copy link
Contributor

r2d4 commented Jan 18, 2018

Yes, this is a feature we would still like. No one has picked it up so far though

@r2d4
Copy link
Contributor

r2d4 commented Jan 18, 2018

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Jan 18, 2018
@alexbrand
Copy link
Contributor

@r2d4 I keep running into this, so I thought I'd take a stab at implementing. It seems like we could have a minikube profile list command, similar to the minikube service list command that already exists. Does that sound reasonable?

I am also wondering if it makes sense to implement a minikube profile set or minikube profile use command, that would supersede minikube profile. The only concern there is backward compat.

@javajon
Copy link

javajon commented Apr 24, 2018

@alexbrand Good ideas. Some thoughts and cautions as improvements to public CLIs can be deceivingly complex:

An asterisk next to the currently profile in the list would be consistent with:

$ git branch
  canary
* master

When listing the profiles would the list just be the profile names or would there be a table of meta information such as status, size, last run, created, etc. or would there be minikube profile [profilename] -describe command?

Also, by adding the list verb to profile noun this would conflict with the default behavior when profile without a verb implies set as in the existing: minikube profile MINIKUBE_PROFILE_NAME. There may be a need for a set verb such as minikube profile set MINIKUBE_PROFILE_NAME. Consider set over use as the kubectl command has set instead of use. Some verbs/commands in this form minikube profile [command] could be: set, list.

This is not to be confused with create or delete, for a CRUD like approach. This would then conflict with minikube delete -p. Also, it would not fully complete CRUD as minikube start -p creates the profile the first time start is invoked for a profile (confusingly, start only behaves like this when the profile does not exist).

Disturbingly, the minikube style of commands conflict with the style of kubectl commands as they are often used in concert. For instance to get a list of pods it's kubectl get pods, where the verb/command comes first followed by the noun, where with minikube the style is noun then verb/command such as minikube service list. It would be better if the minikube CLI was stylistically consistent with kubectl such as minikube list services and minikube list profiles. This context switching adds to the tool usage friction. Example: kubectl delete is benign yet if you go to fast and forget to change your mental context then minikube delete is aggressively destructive as there is no confirmation or undo.

@gonzalesraul
Copy link

This is my hack to get it done:
https://gist.github.com/gonzalesraul/92c45cb473aa61c0399dfa015f903e4c

  1. Load it on your SHELL:
source <(curl -s https://gist.githubusercontent.com/gonzalesraul/92c45cb473aa61c0399dfa015f903e4c/raw/dc885f0eee5a587940647359af09ea31abf83355/minikube_profile.sh)
  1. Use it:
$ minikube profile list
* camigol (not created)
  stack1
  minikube

NOTES:

  1. minikube accepts profile names that does not exists, in this case, when you list and the current profile is not created yet, it will display the suffix "(not created)";
  2. In order to change profiles and prevent issues with bad format command, the command set must be used, for instance minikube profile set PROFILE_NAME

@tstromberg tstromberg added the area/profiles issues related to profile handling label Sep 19, 2018
@malkir
Copy link

malkir commented Oct 20, 2018

Slight change to your nice solution @gonzalesraul for portability, OSX behavior for grep -oP fails due to OSX not having -P and -o only grabbing literal profile from the file. I assume perl might be a little more consistent. Tested this and it seems to work well despite things being thrown at it:

current=`grep profile $HOME/.minikube/config/config.json | perl -p -e 's~[\W\w]*?:\s*+"([\W\w]*?)"~\1~g'`

Examples:

➜  newcluster ~ source <(cat profile.sh)
➜  newcluster ~ minikube profile set 'something"ugly\"really\\"uggllyy.$#@'
minikube profile was successfully set to something"ugly\"really\\"uggllyy.$#@
➜  newcluster ~ minikube profile list
* somethinggly\\"really\\\"uggllyy.$#@" (not created)
  minikube
  newcluster
➜  newcluster ~ minikube profile set 'Ugly@#*(""""neio\\""'
minikube profile was successfully set to Ugly@#*(""""neio\\""
➜  newcluster ~ minikube profile list
* Ugly@#*(\"\"\"neio\\\"\"" (not created)
  minikube
  newcluster

@tstromberg tstromberg added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 24, 2019
@tstromberg tstromberg added the r/2019q2 Issue was last reviewed 2019q2 label May 22, 2019
karthikv81 added a commit to karthikv81/minikube that referenced this issue Jun 26, 2019
karthikv81 added a commit to karthikv81/minikube that referenced this issue Jun 26, 2019
@tstromberg
Copy link
Contributor

Implemented in minikube v1.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/profiles issues related to profile handling help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. 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. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. r/2019q2 Issue was last reviewed 2019q2
Projects
None yet
Development

No branches or pull requests

10 participants