allow users to supply custom QEMU firmware path
parent
fddd3d9440
commit
9cc18c0aa6
|
@ -136,6 +136,7 @@ const (
|
|||
binaryMirror = "binary-mirror"
|
||||
disableOptimizations = "disable-optimizations"
|
||||
disableMetrics = "disable-metrics"
|
||||
qemuFirmwarePath = "qemu-firmware-path"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -253,6 +254,9 @@ func initDriverFlags() {
|
|||
startCmd.Flags().String(listenAddress, "", "IP Address to use to expose ports (docker and podman driver only)")
|
||||
startCmd.Flags().StringSlice(ports, []string{}, "List of ports that should be exposed (docker and podman driver only)")
|
||||
startCmd.Flags().String(subnet, "", "Subnet to be used on kic cluster. If left empty, minikube will choose subnet address, beginning from 192.168.49.0. (docker and podman driver only)")
|
||||
|
||||
// qemu
|
||||
startCmd.Flags().String(qemuFirmwarePath, "", "Path to the qemu firmware file. Defaults: For linux, the default firmware location. For macOS, the brew installation location. For Windows, C:\\Program Files\\qemu\\share")
|
||||
}
|
||||
|
||||
// initNetworkingFlags inits the commandline flags for connectivity related flags for start
|
||||
|
@ -523,6 +527,7 @@ func generateNewConfigFromFlags(cmd *cobra.Command, k8sVersion string, rtime str
|
|||
BinaryMirror: viper.GetString(binaryMirror),
|
||||
DisableOptimizations: viper.GetBool(disableOptimizations),
|
||||
DisableMetrics: viper.GetBool(disableMetrics),
|
||||
CustomQemuFirmwarePath: viper.GetString(qemuFirmwarePath),
|
||||
KubernetesConfig: config.KubernetesConfig{
|
||||
KubernetesVersion: k8sVersion,
|
||||
ClusterName: ClusterFlagValue(),
|
||||
|
@ -741,6 +746,7 @@ func updateExistingConfigFromFlags(cmd *cobra.Command, existing *config.ClusterC
|
|||
updateStringFromFlag(cmd, &cc.MountUID, mountUID)
|
||||
updateStringFromFlag(cmd, &cc.BinaryMirror, binaryMirror)
|
||||
updateBoolFromFlag(cmd, &cc.DisableOptimizations, disableOptimizations)
|
||||
updateStringFromFlag(cmd, &cc.CustomQemuFirmwarePath, qemuFirmwarePath)
|
||||
|
||||
if cmd.Flags().Changed(kubernetesVersion) {
|
||||
cc.KubernetesConfig.KubernetesVersion = getKubernetesVersion(existing)
|
||||
|
|
|
@ -101,6 +101,7 @@ type ClusterConfig struct {
|
|||
BinaryMirror string // Mirror location for kube binaries (kubectl, kubelet, & kubeadm)
|
||||
DisableOptimizations bool
|
||||
DisableMetrics bool
|
||||
CustomQemuFirmwarePath string
|
||||
}
|
||||
|
||||
// KubernetesConfig contains the parameters used to configure the VM Kubernetes.
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
"runtime"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/spf13/viper"
|
||||
"k8s.io/minikube/pkg/drivers/qemu"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
|
@ -64,7 +65,10 @@ func qemuSystemProgram() (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func qemuFirmwarePath() (string, error) {
|
||||
func qemuFirmwarePath(customPath string) (string, error) {
|
||||
if customPath != "" {
|
||||
return customPath, nil
|
||||
}
|
||||
arch := runtime.GOARCH
|
||||
// For macOS, find the correct brew installation path for qemu firmware
|
||||
if runtime.GOOS == "darwin" {
|
||||
|
@ -126,7 +130,7 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
|
|||
default:
|
||||
return nil, fmt.Errorf("unknown arch: %s", runtime.GOARCH)
|
||||
}
|
||||
qemuFirmware, err := qemuFirmwarePath()
|
||||
qemuFirmware, err := qemuFirmwarePath(cc.CustomQemuFirmwarePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -166,12 +170,12 @@ func status() registry.State {
|
|||
return registry.State{Error: err, Fix: "Install qemu-system", Doc: docURL}
|
||||
}
|
||||
|
||||
qemuFirmware, err := qemuFirmwarePath()
|
||||
qemuFirmware, err := qemuFirmwarePath(viper.GetString("qemu-firmware-path"))
|
||||
if err != nil {
|
||||
return registry.State{Error: err, Doc: docURL}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(qemuFirmware); err != nil && runtime.GOARCH == "arm64" {
|
||||
if _, err := os.Stat(qemuFirmware); err != nil {
|
||||
return registry.State{Error: err, Fix: "Install uefi firmware", Doc: docURL}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue