Merge pull request #231 from stevesloka/addCPUFlag

Added flag to allow the number of CPU's to be specified
pull/241/head
dlorenc 2016-06-27 13:06:59 -07:00 committed by GitHub
commit 03608ab6ba
5 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import (
var (
minikubeISO string
memory int
cpus int
vmDriver string
)
@ -55,6 +56,7 @@ func runStart(cmd *cobra.Command, args []string) {
config := cluster.MachineConfig{
MinikubeISO: minikubeISO,
Memory: memory,
CPUs: cpus,
VMDriver: vmDriver,
}
@ -158,5 +160,6 @@ func init() {
startCmd.Flags().StringVarP(&minikubeISO, "iso-url", "", constants.DefaultIsoUrl, "Location of the minikube iso")
startCmd.Flags().StringVarP(&vmDriver, "vm-driver", "", constants.DefaultVMDriver, fmt.Sprintf("VM driver is one of: %v", constants.SupportedVMDrivers))
startCmd.Flags().IntVarP(&memory, "memory", "", constants.DefaultMemory, "Amount of RAM allocated to the minikube VM")
startCmd.Flags().IntVarP(&cpus, "cpus", "", constants.DefaultCPUS, "Number of CPUs allocated to the minikube VM")
RootCmd.AddCommand(startCmd)
}

View File

@ -15,6 +15,7 @@ minikube start
### Options
```
--cpus=1: Number of CPUs allocated to the minikube VM
--iso-url="https://storage.googleapis.com/minikube/minikube-0.4.iso": Location of the minikube iso
--memory=1024: Amount of RAM allocated to the minikube VM
--vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion]

View File

@ -160,6 +160,7 @@ type sshAble interface {
type MachineConfig struct {
MinikubeISO string
Memory int
CPUs int
VMDriver string
}
@ -274,6 +275,7 @@ func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) {
d := virtualbox.NewDriver(constants.MachineName, constants.Minipath)
d.Boot2DockerURL = config.MinikubeISO
d.Memory = config.Memory
d.CPU = config.CPUs
driver = d
case "vmwarefusion":
driver = createVMwareFusionHost(config)

View File

@ -26,9 +26,9 @@ func createVMwareFusionHost(config MachineConfig) drivers.Driver {
d := vmwarefusion.NewDriver(constants.MachineName, constants.Minipath).(*vmwarefusion.Driver)
d.Boot2DockerURL = config.MinikubeISO
d.Memory = config.Memory
d.CPU = config.CPUs
// TODO(philips): push these defaults upstream to fixup this driver
d.CPU = 1
d.SSHPort = 22
d.ISO = d.ResolveStorePath("boot2docker.iso")
return d

View File

@ -53,6 +53,7 @@ var SupportedVMDrivers = [...]string{
const (
DefaultIsoUrl = "https://storage.googleapis.com/minikube/minikube-0.4.iso"
DefaultMemory = 1024
DefaultCPUS = 1
DefaultVMDriver = "virtualbox"
)