Skip to content

Add krunkit driver supporting GPU acceleration on macOS #20826

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 15 additions & 2 deletions cmd/minikube/cmd/start_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func initMinikubeFlags() {
startCmd.Flags().String(network, "", "network to run minikube with. Used by docker/podman, qemu, kvm, and vfkit drivers. If left empty, minikube will create a new network.")
startCmd.Flags().StringVarP(&outputFormat, "output", "o", "text", "Format to print stdout in. Options include: [text,json]")
startCmd.Flags().String(trace, "", "Send trace events. Options include: [gcp]")
startCmd.Flags().Int(extraDisks, 0, "Number of extra disks created and attached to the minikube VM (currently only implemented for hyperkit, kvm2, qemu2, and vfkit drivers)")
startCmd.Flags().Int(extraDisks, 0, "Number of extra disks created and attached to the minikube VM (currently only implemented for hyperkit, kvm2, qemu2, vfkit, and krunkit drivers)")
startCmd.Flags().Duration(certExpiration, constants.DefaultCertExpiration, "Duration until minikube certificate expiration, defaults to three years (26280h).")
startCmd.Flags().String(binaryMirror, "", "Location to fetch kubectl, kubelet, & kubeadm binaries from.")
startCmd.Flags().Bool(disableOptimizations, false, "If set, disables optimizations that are set for local Kubernetes. Including decreasing CoreDNS replicas from 2 to 1. Defaults to false.")
Expand Down Expand Up @@ -488,6 +488,8 @@ func getNetwork(driverName string) string {
return validateQemuNetwork(n)
} else if driver.IsVFKit(driverName) {
return validateVfkitNetwork(n)
} else if driver.IsKrunkit(driverName) {
return validateKrunkitNetwork(n)
}
return n
}
Expand Down Expand Up @@ -546,6 +548,17 @@ func validateVfkitNetwork(n string) string {
return n
}

func validateKrunkitNetwork(n string) string {
if runtime.GOOS != "darwin" && runtime.GOARCH != "arm64" {
exit.Message(reason.Usage, "The krunkit driver is only supported on macOS arm64 machines")
}
if err := vmnet.ValidateHelper(); err != nil {
vmnetErr := err.(*vmnet.Error)
exit.Message(vmnetErr.Kind, "The krunkit driver requires vment-helper: {{.reason}}", out.V{"reason": err})
}
return n
}

// generateNewConfigFromFlags generate a config.ClusterConfig based on flags
func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, rtime string, drvName string) config.ClusterConfig {
var cc config.ClusterConfig
Expand Down Expand Up @@ -1011,7 +1024,7 @@ func interpretWaitFlag(cmd cobra.Command) map[string]bool {
}

func checkExtraDiskOptions(cmd *cobra.Command, driverName string) {
supportedDrivers := []string{driver.HyperKit, driver.KVM2, driver.QEMU2, driver.VFKit}
supportedDrivers := []string{driver.HyperKit, driver.KVM2, driver.QEMU2, driver.VFKit, driver.Krunkit}

if cmd.Flags().Changed(extraDisks) {
supported := false
Expand Down
3 changes: 3 additions & 0 deletions hack/jenkins/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ case "${DRIVER}" in
vfkit)
echo "vfkit: $(vfkit --version)"
;;
krunkit)
echo "krunkit: $(krunkit --version)"
;;
esac

echo ""
Expand Down
39 changes: 39 additions & 0 deletions hack/jenkins/osx_integration_tests_krunkit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Copyright 2024 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# This script runs the integration tests on an OSX machine for the Hyperkit Driver

# The script expects the following env variables:
# MINIKUBE_LOCATION: GIT_COMMIT from upstream build.
# COMMIT: Actual commit ID from upstream build
# EXTRA_BUILD_ARGS (optional): Extra args to be passed into the minikube integrations tests
# access_token: The GitHub API access token. Injected by the Jenkins credential provider.


set -ex

ARCH="arm64"
OS="darwin"
DRIVER="krunkit"
JOB_NAME="Krunkit_macOS"
EXTRA_TEST_ARGS=""
EXTERNAL="yes"

brew tap slp/krunkit
brew install krunkit

source common.sh
Loading
Loading