diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index 0a52c52e9be09ef39546c841000b99b5c6af8b5f..704b9b1d191f7817d2102255b3b0a4b4e4c5ccf9 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -177,6 +177,10 @@ var settings = []Setting{ name: useVendoredDriver, set: SetBool, }, + { + name: "disable-driver-mounts", + set: SetBool, + }, } var ConfigCmd = &cobra.Command{ diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 8c28a3bf2dbb20fb074f2dfb2a2f6e041ecbe4da..8982b8d41eabf044f5ee63322cb92b47c0e7825d 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -61,6 +61,7 @@ const ( apiServerName = "apiserver-name" dnsDomain = "dns-domain" mountString = "mount-string" + disableDriverMounts = "disable-driver-mounts" ) var ( @@ -116,6 +117,7 @@ func runStart(cmd *cobra.Command, args []string) { HypervVirtualSwitch: viper.GetString(hypervVirtualSwitch), KvmNetwork: viper.GetString(kvmNetwork), Downloader: pkgutil.DefaultDownloader{}, + DisableDriverMounts: viper.GetBool(disableDriverMounts), } fmt.Printf("Starting local Kubernetes %s cluster...\n", viper.GetString(kubernetesVersion)) @@ -288,6 +290,7 @@ func init() { startCmd.Flags().Bool(keepContext, constants.DefaultKeepContext, "This will keep the existing kubectl context and will create a minikube context.") startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube") startCmd.Flags().String(mountString, constants.DefaultMountDir+":"+constants.DefaultMountEndpoint, "The argument to pass the minikube mount command on start") + startCmd.Flags().Bool(disableDriverMounts, false, "Disables the filesystem mounts provided by the hypervisors (vboxfs, xhyve-9p)") startCmd.Flags().String(isoURL, constants.DefaultIsoUrl, "Location of the minikube iso") startCmd.Flags().String(vmDriver, constants.DefaultVMDriver, fmt.Sprintf("VM driver is one of: %v", constants.SupportedVMDrivers)) startCmd.Flags().Int(memory, constants.DefaultMemory, "Amount of RAM allocated to the minikube VM") diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index b438cc16ee325892967a9febaf62899fd708689e..93ef689fe4dc64c48b3503ff1e4766d85170da97 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -341,6 +341,7 @@ func createVirtualboxHost(config MachineConfig) drivers.Driver { d.CPU = config.CPUs d.DiskSize = int(config.DiskSize) d.HostOnlyCIDR = config.HostOnlyCIDR + d.NoShare = config.DisableDriverMounts return d } diff --git a/pkg/minikube/cluster/cluster_darwin.go b/pkg/minikube/cluster/cluster_darwin.go index 3421c50f3406ca34b0de28612f1c7eed6f363550..85dfccd027a86e2b95b9a80581fd2b0dcde33cf9 100644 --- a/pkg/minikube/cluster/cluster_darwin.go +++ b/pkg/minikube/cluster/cluster_darwin.go @@ -58,6 +58,7 @@ type xhyveDriver struct { } func createXhyveHost(config MachineConfig) *xhyveDriver { + useVirtio9p := !config.DisableDriverMounts return &xhyveDriver{ BaseDriver: &drivers.BaseDriver{ MachineName: cfg.GetMachineName(), @@ -68,6 +69,8 @@ func createXhyveHost(config MachineConfig) *xhyveDriver { Boot2DockerURL: config.Downloader.GetISOFileURI(config.MinikubeISO), BootCmd: "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=" + cfg.GetMachineName(), DiskSize: int64(config.DiskSize), + Virtio9p: useVirtio9p, + Virtio9pFolder: "/Users", QCow2: false, RawDisk: config.XhyveDiskDriver == "virtio-blk", } diff --git a/pkg/minikube/cluster/types.go b/pkg/minikube/cluster/types.go index df5f5fab79c7f07fb6262e7308970ea0ed12bc09..fa237515e66265104f9283c854e8852b1ec4d7ec 100644 --- a/pkg/minikube/cluster/types.go +++ b/pkg/minikube/cluster/types.go @@ -34,6 +34,7 @@ type MachineConfig struct { KvmNetwork string // Only used by the KVM driver Downloader util.ISODownloader DockerOpt []string // Each entry is formatted as KEY=VALUE. + DisableDriverMounts bool // Only used by virtualbox and xhyve } // KubernetesConfig contains the parameters used to configure the VM Kubernetes.