Skip to content

Commit

Permalink
Merge pull request #5960 from davidnewman/issue/5959
Browse files Browse the repository at this point in the history
Add option for virtualbox users to set nat-nic-type
  • Loading branch information
medyagh authored Nov 25, 2019
2 parents b398810 + fbb1d97 commit 8a4c7d3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ const (
minimumCPUS = 2
minimumDiskSize = "2000mb"
autoUpdate = "auto-update-drivers"
hostOnlyNicType = "host-only-nic-type"
natNicType = "nat-nic-type"
)

var (
Expand Down Expand Up @@ -208,6 +210,8 @@ func initDriverFlags() {
startCmd.Flags().Bool(dnsProxy, false, "Enable proxy for NAT DNS requests (virtualbox driver only)")
startCmd.Flags().Bool(hostDNSResolver, true, "Enable host resolver for NAT DNS requests (virtualbox driver only)")
startCmd.Flags().Bool(noVTXCheck, false, "Disable checking for the availability of hardware virtualization before the vm is started (virtualbox driver only)")
startCmd.Flags().String(hostOnlyNicType, "virtio", "NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)")
startCmd.Flags().String(natNicType, "virtio", "NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)")

// hyperkit
startCmd.Flags().StringSlice(vsockPorts, []string{}, "List of guest VSock ports that should be exposed as sockets on the host (hyperkit driver only)")
Expand Down Expand Up @@ -912,6 +916,8 @@ func generateCfgFromFlags(cmd *cobra.Command, k8sVersion string, drvName string)
NoVTXCheck: viper.GetBool(noVTXCheck),
DNSProxy: viper.GetBool(dnsProxy),
HostDNSResolver: viper.GetBool(hostDNSResolver),
HostOnlyNicType: viper.GetString(hostOnlyNicType),
NatNicType: viper.GetString(natNicType),
KubernetesConfig: cfg.KubernetesConfig{
KubernetesVersion: k8sVersion,
NodePort: viper.GetInt(apiServerPort),
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ require (
github.com/docker/machine v0.7.1-0.20190718054102-a555e4f7a8f5 // version is 0.7.1 to pin to a555e4f7a8f5
github.com/elazarl/goproxy v0.0.0-20190421051319-9d40249d3c2f
github.com/elazarl/goproxy/ext v0.0.0-20190421051319-9d40249d3c2f // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.3.0
github.com/gorilla/mux v1.7.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.5.0 // indirect
github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce // indirect
github.com/hashicorp/go-getter v1.4.0
github.com/hashicorp/go-multierror v0.0.0-20160811015721-8c5f0ad93604 // indirect
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type MachineConfig struct {
DNSProxy bool // Only used by virtualbox
HostDNSResolver bool // Only used by virtualbox
KubernetesConfig KubernetesConfig
HostOnlyNicType string // Only used by virtualbox
NatNicType string // Only used by virtualbox
}

// KubernetesConfig contains the parameters used to configure the VM Kubernetes.
Expand Down
7 changes: 3 additions & 4 deletions pkg/minikube/registry/drvs/virtualbox/virtualbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import (
)

const (
defaultVirtualboxNicType = "virtio"
docURL = "https://minikube.sigs.k8s.io/docs/reference/drivers/virtualbox/"
docURL = "https://minikube.sigs.k8s.io/docs/reference/drivers/virtualbox/"
)

func init() {
Expand All @@ -57,8 +56,8 @@ func configure(mc config.MachineConfig) interface{} {
d.HostOnlyCIDR = mc.HostOnlyCIDR
d.NoShare = mc.DisableDriverMounts
d.NoVTXCheck = mc.NoVTXCheck
d.NatNicType = defaultVirtualboxNicType
d.HostOnlyNicType = defaultVirtualboxNicType
d.NatNicType = mc.NatNicType
d.HostOnlyNicType = mc.HostOnlyNicType
d.DNSProxy = mc.DNSProxy
d.HostDNSResolver = mc.HostDNSResolver
return d
Expand Down

0 comments on commit 8a4c7d3

Please sign in to comment.