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

Added --name flag and MINIKUBE_NAME env var for vm machine name #1320

Merged
merged 1 commit into from
Apr 19, 2017

Conversation

aaron-prindle
Copy link
Contributor

@aaron-prindle aaron-prindle commented Apr 3, 2017

This allows users to specify the vm name for minikube to allow for multiple minikubeVMs to be created. This enables multiple minikubes to be managed on a single machine.

Example use:

$ minikube start --name=test
$ minikube start --name=test2
#VM created w/ name test
$ minikube status --name=test
$ minikube status --name=test2
$ minikube delete --name=test
$ minikube delete --name=test2
$ minikube start --name=test
$ minikube start --name=test2
$ minikube config set name test
$ minikube status
$ minikube logs
....
$ minikube config set name test2
$ minikube status
$ minikube logs
....

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 3, 2017
@codecov-io
Copy link

codecov-io commented Apr 3, 2017

Codecov Report

Merging #1320 into master will decrease coverage by 0.02%.
The diff coverage is 43.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1320      +/-   ##
==========================================
- Coverage   43.06%   43.03%   -0.03%     
==========================================
  Files          48       48              
  Lines        2271     2277       +6     
==========================================
+ Hits          978      980       +2     
- Misses       1133     1137       +4     
  Partials      160      160
Impacted Files Coverage Δ
pkg/minikube/config/config.go 32.14% <0%> (-5.36%) ⬇️
cmd/minikube/cmd/start.go 21.31% <0%> (ø) ⬆️
pkg/minikube/cluster/cluster_linux.go 0% <0%> (ø) ⬆️
cmd/minikube/cmd/ip.go 11.76% <0%> (ø) ⬆️
cmd/minikube/cmd/env.go 68% <100%> (ø) ⬆️
cmd/minikube/cmd/root.go 68.33% <100%> (+1.09%) ⬆️
pkg/minikube/cluster/cluster.go 55% <55%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ce80e5...1b79cfd. Read the comment docs.

@@ -160,7 +160,7 @@ func shellCfgSet(api libmachine.API) (*ShellConfig, error) {
}

if noProxy {
host, err := api.Load(constants.MachineName)
host, err := api.Load(constants.GetMachineName())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move this from constants to config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@aaron-prindle aaron-prindle force-pushed the multiple-vms branch 3 times, most recently from 2e849dd to fc4449a Compare April 17, 2017 21:38
@aaron-prindle
Copy link
Contributor Author

@minikube-bot retest this please

2 similar comments
@aaron-prindle
Copy link
Contributor Author

@minikube-bot retest this please

@aaron-prindle
Copy link
Contributor Author

@minikube-bot retest this please

Copy link
Contributor

@r2d4 r2d4 left a comment

Choose a reason for hiding this comment

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

Might be worth it to switch the env getting to use viper, since then we also get the config file for free. Either way, LGTM


// Minipath is the path to the user's minikube dir
func GetMachineName() string {
if os.Getenv(MinikubeName) == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use viper.GetString here? Viper looks at env vars, so you could call it minikube-name and that would translate to MINIKUBE_NAME

I think we should also add this to minikube config set/unset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. Also added "--name" as a flag to all minikube commands

@aaron-prindle aaron-prindle changed the title Added MINIKUBE_NAME option for vm machine name Added --name flag and MINIKUBE_NAME env var for vm machine name Apr 19, 2017
@aaron-prindle
Copy link
Contributor Author

Fixes #886

@jorgemoralespou
Copy link

Although I live the feature had been finally implemented, I have to say that how to set the active instance/VM is not really easy and friendly.
I would rather simplify that action to Ann easier command.
"minikube activate " or something similar, which is a single command and provide a name to easily identify the action.

Also I would think that using shortcut for options sound be allowed.

minikube start --name=test
minikube start -n test

@aaron-prindle
Copy link
Contributor Author

aaron-prindle commented May 3, 2017

@jorgemoralespou minikube activate <name> would seem to be very similar to the current minikube config set name <name> which works currently. Is the minikube config set name <name> command sufficient for your workflow? I agree that -n seems like a reasonable shortcut for this, if you'd like you can submit a feature request or PR.

@jorgemoralespou
Copy link

@aaron-prindle my main concern is about user experience. I find minikube config set name <name> not use friendly and not self explanatory.

For the -n I would submit a PR but I'm no go developer so better if I don't 😉 I'll open a feature request.

@jemc
Copy link

jemc commented May 30, 2017

For anyone else who saw this and expected to be able to use the --name argument in the latest minikube release, it appears to have been renamed as --profile.

@gbraad
Copy link
Contributor

gbraad commented May 31, 2017

^^ this is due to #1466 "Changed --name to --profile / -p"

@fhemberger
Copy link

@aaron-prindle @jorgemoralespou Hi, found this PR through Google while looking for this feature, it says, that this change was released in v0.20.0, however minikube start --help doesn't list the switch. Am I missing something?

@aaron-prindle
Copy link
Contributor Author

aaron-prindle commented Jul 5, 2017

@fhemberger --profile is a global flag to all minikube commands, it would be at the end of the minikube start --help in the Global Flags: section of the output:

aprindle@aprindle:$ minikube start --help | grep profile
  -p, --profile string                   The name of the minikube VM being used.

This flag can be used in all minikube commands, it is not strictly a start flag.

@fhemberger
Copy link

@aaron-prindle Ah, great. Thanks! 👍

@qafro1
Copy link

qafro1 commented Jan 23, 2018

So What's the commands for multiple minikubes ?

@lindhe
Copy link

lindhe commented Jul 20, 2020

Is this feature removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet