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

feat: add VMware driver support for new minikube ISO #16796

Merged
merged 2 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: vmware driver support for new minikube iso
  • Loading branch information
lbogdan authored and spowelljr committed Jul 12, 2023
commit 380359c0ef115abbf4977671034b17eefc94ac81
59 changes: 53 additions & 6 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@
}

virtualBoxMacOS13PlusWarning(driverName)
vmwareUnsupported(driverName)
validateFlags(cmd, driverName)
validateUser(driverName)
if driverName == oci.Docker {
Expand Down Expand Up @@ -411,14 +410,62 @@
`, out.V{"driver": suggestedDriver})
}

func vmwareUnsupported(driverName string) {
if !driver.IsVMware(driverName) {
// isBootpdBlocked returns true if the built-in macOS firewall is on and bootpd is not unblocked
func isBootpdBlocked(cc config.ClusterConfig) bool {

Check failure on line 414 in cmd/minikube/cmd/start.go

View workflow job for this annotation

GitHub Actions / lint

func `isBootpdBlocked` is unused (unused)
// only applies to qemu, on macOS, with socket_vmnet
if cc.Driver != driver.QEMU2 || runtime.GOOS != "darwin" || cc.Network != "socket_vmnet" {
return false
}
out, err := exec.Command("/usr/libexec/ApplicationFirewall/socketfilterfw", "--getglobalstate").Output()
if err != nil {
klog.Warningf("failed to get firewall state: %v", err)
return false
}
if regexp.MustCompile(`Firewall is disabled`).Match(out) {
return false
}
out, err = exec.Command("/usr/libexec/ApplicationFirewall/socketfilterfw", "--listapps").Output()
if err != nil {
klog.Warningf("failed to list firewall apps: %v", err)
return false
}
return !regexp.MustCompile(`\/usr\/libexec\/bootpd.*\n.*\( Allow`).Match(out)
}

// unblockBootpdFirewall adds bootpd to the built-in macOS firewall and then unblocks it
func unblockBootpdFirewall(cc config.ClusterConfig) {

Check failure on line 436 in cmd/minikube/cmd/start.go

View workflow job for this annotation

GitHub Actions / lint

func `unblockBootpdFirewall` is unused (unused)
if !isBootpdBlocked(cc) {
return
}
exit.Message(reason.DrvUnsupported, `Due to security improvements to minikube the VMware driver is currently not supported. Available workarounds are to use a different driver or downgrade minikube to v1.29.0.

We are accepting community contributions to fix this, for more details on the issue see: https://github.com/kubernetes/minikube/issues/16221
`)
cmds := []*exec.Cmd{
exec.Command("sudo", "/usr/libexec/ApplicationFirewall/socketfilterfw", "--add", "/usr/libexec/bootpd"),
exec.Command("sudo", "/usr/libexec/ApplicationFirewall/socketfilterfw", "--unblock", "/usr/libexec/bootpd"),
}

var cmdString strings.Builder
for _, c := range cmds {
cmdString.WriteString(fmt.Sprintf(" $ %s \n", strings.Join(c.Args, " ")))
}

out.Styled(style.Permissions, "Your firewall is blocking bootpd which is required for socket_vmnet. The following commands will be executed to unblock bootpd:\n\n{{.commands}}\n", out.V{"commands": cmdString.String()})

for _, c := range cmds {
testArgs := append([]string{"-n"}, c.Args[1:]...)
test := exec.Command("sudo", testArgs...)
klog.Infof("testing: %s", test.Args)
if err := test.Run(); err != nil {
klog.Infof("%v may require a password: %v", c.Args, err)
if !viper.GetBool("interactive") {
klog.Warningf("%s requires a password, and --interactive=false", c.Args)
}
}
klog.Infof("running: %s", c.Args)
err := c.Run()
if err != nil {
klog.Warningf("running %s failed: %v", c.Args, err)
}
}
}

func validateBuiltImageVersion(r command.Runner, driverName string) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ replace (
github.com/Parallels/docker-machine-parallels/v2 => github.com/minikube-machine/machine-driver-parallels/v2 v2.0.1
github.com/briandowns/spinner => github.com/alonyb/spinner v1.12.7
github.com/docker/machine => github.com/minikube-machine/machine v0.0.0-20230610170757-350a83297593
github.com/machine-drivers/docker-machine-driver-vmware => github.com/minikube-machine/machine-driver-vmware v0.1.5
github.com/machine-drivers/docker-machine-driver-vmware => github.com/lbogdan/docker-machine-driver-vmware v0.2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lbogdan do you mind making this PR to the new Org https://github.com/minikube-machine/machine-driver-vmware ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will get to it on Friday, weekend at the latest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For getting the release out in time we'll merge this and then change it back to our fork once the change gets merged upstream.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github.com/samalba/dockerclient => github.com/sayboras/dockerclient v1.0.0
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.22.4
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lbogdan/docker-machine-driver-vmware v0.2.0 h1:ew0GbsB9/TeQjPO3nWgivOmx7EakXeMbS5kvArvddOM=
github.com/lbogdan/docker-machine-driver-vmware v0.2.0/go.mod h1:HifYFOWR0bAMN4hWtaSADClogvtPy/jV0aRC5alhrKo=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/linode/linodego v1.4.0/go.mod h1:PVsRxSlOiJyvG4/scTszpmZDTdgS+to3X6eS8pRrWI8=
github.com/linuxkit/virtsock v0.0.0-20201010232012-f8cee7dfc7a3/go.mod h1:3r6x7q95whyfWQpmGZTu3gk3v2YkMi05HEzl7Tf7YEo=
Expand Down
Loading