Skip to content

Commit

Permalink
Add xhyve driver support
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Jul 1, 2016
1 parent 4686db6 commit 16ab06c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 17 deletions.
31 changes: 31 additions & 0 deletions DRIVERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Driver plugin installation

Minikube uses Docker Machine to manage the Kubernetes VM so it benefits from the
driver plugin architecture that Docker Machine uses to provide a consistent way to
manage various VM providers. Minikube embeds VirtualBox and VMware Fusion drivers
so there are no additional steps to use them. However, other drivers require an
extra binary to be present in the host PATH.

The following drivers currently require driver plugin binaries to be present in
the host PATH:

* [KVM](#kvm-driver)
* [xhyve](#xhyve-driver)

#### KVM driver

Download the `docker-machine-driver-kvm` binary from
https://github.com/dhiltgen/docker-machine-kvm/releases and put it somewhere in
your PATH. Minikube is currently tested against `docker-machine-driver-kvm` 0.7.0.

#### xhyve driver

From https://github.com/zchee/docker-machine-driver-xhyve#install:

```
$ brew install docker-machine-driver-xhyve
# docker-machine-driver-xhyve need root owner and uid
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
```
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a

### Requirements

* [VirtualBox](https://www.virtualbox.org/wiki/Downloads), [VMware Fusion](https://www.vmware.com/products/fusion)
or [KVM](http://www.linux-kvm.org/) installation
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads), [VMware Fusion](https://www.vmware.com/products/fusion),
[KVM](http://www.linux-kvm.org/) or [xhyve](https://github.com/mist64/xhyve) installation
* VT-x/AMD-v virtualization must be enabled in BIOS

### Instructions
Expand All @@ -35,7 +35,8 @@ the following drivers:

* virtualbox
* vmwarefusion
* kvm ([driver installation](#kvm-driver))
* kvm ([driver installation](DRIVERS.md#kvm-driver))
* xhyve ([driver installation](DRIVES.md#xhyve-driver))

Note that the IP below is dynamic and can change. It can be retrieved with `minikube ip`.

Expand Down Expand Up @@ -70,19 +71,10 @@ Stopping local Kubernetes cluster...
Stopping "minikubeVM"...
```

### Driver plugin installation
### Driver plugins

Minikube uses Docker Machine to manage the Kubernetes VM so it benefits from the
driver plugin architecture that Docker Machine uses to provide a consistent way to
manage various VM providers. Minikube embeds VirtualBox and VMware Fusion drivers
so there are no additional steps to use them. However, other drivers require an
extra binary to be present in the host PATH.

#### KVM driver

Download the `docker-machine-driver-kvm` binary from
https://github.com/dhiltgen/docker-machine-kvm/releases and put it somewhere in
your PATH. Minikube is currently tested against `docker-machine-driver-kvm` 0.7.0.
See [DRIVERS](DRIVERS.md) for details on supported drivers and how to install
plugins, if required.

### Reusing the Docker daemon

Expand Down
2 changes: 1 addition & 1 deletion docs/minikube_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minikube start
--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 kvm]
--vm-driver="virtualbox": VM driver is one of: [virtualbox vmwarefusion kvm xhyve]
```

### Options inherited from parent commands
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ func createHost(api libmachine.API, config MachineConfig) (*host.Host, error) {
driver = createVMwareFusionHost(config)
case "kvm":
driver = createKVMHost(config)
case "xhyve":
driver = createXhyveHost(config)
default:
glog.Exitf("Unsupported driver: %s\n", config.VMDriver)
}
Expand Down
31 changes: 31 additions & 0 deletions pkg/minikube/cluster/cluster_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,34 @@ func createVMwareFusionHost(config MachineConfig) drivers.Driver {
d.ISO = d.ResolveStorePath("boot2docker.iso")
return d
}

type xhyveDriver struct {
*drivers.BaseDriver
Boot2DockerURL string
BootCmd string
CPU int
CaCertPath string
DiskSize int64
MacAddr string
Memory int
PrivateKeyPath string
UUID string
NFSShare bool
DiskNumber int
Virtio9p bool
Virtio9pFolder string
}

func createXhyveHost(config MachineConfig) *xhyveDriver {
return &xhyveDriver{
BaseDriver: &drivers.BaseDriver{
MachineName: constants.MachineName,
StorePath: constants.Minipath,
},
Memory: config.Memory,
CPU: config.CPUs,
Boot2DockerURL: config.MinikubeISO,
BootCmd: "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=boot2docker",
DiskSize: 20000,
}
}
4 changes: 4 additions & 0 deletions pkg/minikube/cluster/cluster_non_darwin_panic.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ import "github.com/docker/machine/libmachine/drivers"
func createVMwareFusionHost(config MachineConfig) drivers.Driver {
panic("vmwarefusion not supported")
}

func createXhyveHost(config MachineConfig) drivers.Driver {
panic("xhyve not supported")
}
2 changes: 1 addition & 1 deletion pkg/minikube/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestCreateHost(t *testing.T) {
}

if !found {
t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion or kvm.", h.DriverName)
t.Fatalf("Wrong driver name: %v. Should be virtualbox, vmwarefusion, kvm or xhyve.", h.DriverName)
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var SupportedVMDrivers = [...]string{
"virtualbox",
"vmwarefusion",
"kvm",
"xhyve",
}

const (
Expand Down

0 comments on commit 16ab06c

Please sign in to comment.