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 Jun 30, 2016
1 parent 4686db6 commit 4f8d396
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 4 deletions.
17 changes: 15 additions & 2 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 @@ -36,6 +36,7 @@ the following drivers:
* virtualbox
* vmwarefusion
* kvm ([driver installation](#kvm-driver))
* xhyve ([driver installation](#xhyve-driver))

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

Expand Down Expand Up @@ -84,6 +85,18 @@ 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
```

### Reusing the Docker daemon

When using a single VM of kubernetes its really handy to reuse the Docker daemon inside the VM; as this means you don't have to build on your host machine and push the image into a docker registry - you can just build inside the same docker daemon as minikube which speeds up local experiments.
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 4f8d396

Please sign in to comment.