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 hyperv virtual switch configuration flag for hyperv driver #719

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const (
hostOnlyCIDR = "host-only-cidr"
containerRuntime = "container-runtime"
networkPlugin = "network-plugin"
hypervVirtualSwitch = "hyperv-virtual-switch"
)

var (
Expand All @@ -69,15 +70,16 @@ func runStart(cmd *cobra.Command, args []string) {
defer api.Close()

config := cluster.MachineConfig{
MinikubeISO: viper.GetString(isoURL),
Memory: viper.GetInt(memory),
CPUs: viper.GetInt(cpus),
DiskSize: calculateDiskSizeInMB(viper.GetString(humanReadableDiskSize)),
VMDriver: viper.GetString(vmDriver),
DockerEnv: dockerEnv,
InsecureRegistry: insecureRegistry,
RegistryMirror: registryMirror,
HostOnlyCIDR: viper.GetString(hostOnlyCIDR),
MinikubeISO: viper.GetString(isoURL),
Memory: viper.GetInt(memory),
CPUs: viper.GetInt(cpus),
DiskSize: calculateDiskSizeInMB(viper.GetString(humanReadableDiskSize)),
VMDriver: viper.GetString(vmDriver),
DockerEnv: dockerEnv,
InsecureRegistry: insecureRegistry,
RegistryMirror: registryMirror,
HostOnlyCIDR: viper.GetString(hostOnlyCIDR),
HypervVirtualSwitch: viper.GetString(hypervVirtualSwitch),
}

var host *host.Host
Expand Down Expand Up @@ -197,6 +199,7 @@ func init() {
startCmd.Flags().Int(cpus, constants.DefaultCPUS, "Number of CPUs allocated to the minikube VM")
startCmd.Flags().String(humanReadableDiskSize, constants.DefaultDiskSize, "Disk size allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or g)")
startCmd.Flags().String(hostOnlyCIDR, "192.168.99.1/24", "The CIDR to be used for the minikube VM (only supported with Virtualbox driver)")
startCmd.Flags().String(hypervVirtualSwitch, "", "The hyperv virtual switch name. Defaults to first found. (only supported with driver)")
startCmd.Flags().StringSliceVar(&dockerEnv, "docker-env", nil, "Environment variables to pass to the Docker daemon. (format: key=value)")
startCmd.Flags().StringSliceVar(&insecureRegistry, "insecure-registry", nil, "Insecure Docker registries to pass to the Docker daemon")
startCmd.Flags().StringSliceVar(&registryMirror, "registry-mirror", nil, "Registry mirrors to pass to the Docker daemon")
Expand Down
27 changes: 14 additions & 13 deletions docs/minikube_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ minikube start
### Options

```
--container-runtime string The container runtime to be used
--cpus int Number of CPUs allocated to the minikube VM (default 2)
--disk-size string Disk size allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or g) (default "20g")
--docker-env value Environment variables to pass to the Docker daemon. (format: key=value) (default [])
--extra-config value A set of key=value pairs that describe configuration that may be passed to different components.
--container-runtime string The container runtime to be used
--cpus int Number of CPUs allocated to the minikube VM (default 2)
--disk-size string Disk size allocated to the minikube VM (format: <number>[<unit>], where unit = b, k, m or g) (default "20g")
--docker-env value Environment variables to pass to the Docker daemon. (format: key=value) (default [])
--extra-config value A set of key=value pairs that describe configuration that may be passed to different components.
The key should be '.' separated, and the first part before the dot is the component to apply the configuration to.
Valid components are: kubelet, apiserver, controller-manager, etcd, proxy, scheduler.
--host-only-cidr string The CIDR to be used for the minikube VM (only supported with Virtualbox driver) (default "192.168.99.1/24")
--insecure-registry value Insecure Docker registries to pass to the Docker daemon (default [])
--iso-url string Location of the minikube iso (default "https://storage.googleapis.com/minikube/minikube-0.7.iso")
--kubernetes-version string The kubernetes version that the minikube VM will (ex: v1.2.3)
--host-only-cidr string The CIDR to be used for the minikube VM (only supported with Virtualbox driver) (default "192.168.99.1/24")
--hyperv-virtual-switch string The hyperv virtual switch name. Defaults to first found. (only supported with driver)
--insecure-registry value Insecure Docker registries to pass to the Docker daemon (default [])
--iso-url string Location of the minikube iso (default "https://storage.googleapis.com/minikube/minikube-0.7.iso")
--kubernetes-version string The kubernetes version that the minikube VM will (ex: v1.2.3)
OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64) (default "v1.4.3")
--memory int Amount of RAM allocated to the minikube VM (default 2048)
--network-plugin string The name of the network plugin
--registry-mirror value Registry mirrors to pass to the Docker daemon (default [])
--vm-driver string VM driver is one of: [virtualbox vmwarefusion kvm xhyve hyperv] (default "virtualbox")
--memory int Amount of RAM allocated to the minikube VM (default 2048)
--network-plugin string The name of the network plugin
--registry-mirror value Registry mirrors to pass to the Docker daemon (default [])
--vm-driver string VM driver is one of: [virtualbox vmwarefusion kvm xhyve hyperv] (default "virtualbox")
```

### Options inherited from parent commands
Expand Down
19 changes: 10 additions & 9 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,16 @@ type sshAble interface {

// MachineConfig contains the parameters used to start a cluster.
type MachineConfig struct {
MinikubeISO string
Memory int
CPUs int
DiskSize int
VMDriver string
DockerEnv []string // Each entry is formatted as KEY=VALUE.
InsecureRegistry []string
RegistryMirror []string
HostOnlyCIDR string // Only used by the virtualbox driver
MinikubeISO string
Memory int
CPUs int
DiskSize int
VMDriver string
DockerEnv []string // Each entry is formatted as KEY=VALUE.
InsecureRegistry []string
RegistryMirror []string
HostOnlyCIDR string // Only used by the virtualbox driver
HypervVirtualSwitch string
}

// KubernetesConfig contains the parameters used to configure the VM Kubernetes.
Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/cluster/cluster_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
func createHypervHost(config MachineConfig) drivers.Driver {
d := hyperv.NewDriver(constants.MachineName, constants.Minipath)
d.Boot2DockerURL = config.GetISOFileURI()
d.VSwitch = config.HypervVirtualSwitch
d.MemSize = config.Memory
d.CPU = config.CPUs
d.DiskSize = int(config.DiskSize)
Expand Down