update comments and store socket_vmnet paths in machine config

pull/15701/head
Steven Powell 2023-01-25 10:45:20 -08:00
parent c248182197
commit 0fbb9a6a31
14 changed files with 87 additions and 78 deletions

View File

@ -281,8 +281,8 @@ func initNetworkingFlags() {
startCmd.Flags().Int(sshSSHPort, defaultSSHPort, "SSH port (ssh driver only)")
// socket vmnet
startCmd.Flags().String(socketVMnetClientPath, "", "Path to the socket vmnet client binary")
startCmd.Flags().String(socketVMnetPath, "", "Path to socket vmnet binary")
startCmd.Flags().String(socketVMnetClientPath, "", "Path to the socket vmnet client binary (QEMU driver only)")
startCmd.Flags().String(socketVMnetPath, "", "Path to socket vmnet binary (QEMU driver only)")
}
// ClusterFlagValue returns the current cluster name based on flags

View File

@ -40,7 +40,6 @@ import (
"github.com/pkg/errors"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/minikube/detect"
)
const (
@ -56,30 +55,32 @@ type Driver struct {
EnginePort int
FirstQuery bool
Memory int
DiskSize int
CPU int
Program string
BIOS bool
CPUType string
MachineType string
Firmware string
Display bool
DisplayType string
Nographic bool
VirtioDrives bool
Network string
PrivateNetwork string
Boot2DockerURL string
CaCertPath string
PrivateKeyPath string
DiskPath string
CacheMode string
IOMode string
UserDataFile string
CloudConfigRoot string
LocalPorts string
MACAddress string
Memory int
DiskSize int
CPU int
Program string
BIOS bool
CPUType string
MachineType string
Firmware string
Display bool
DisplayType string
Nographic bool
VirtioDrives bool
Network string
PrivateNetwork string
Boot2DockerURL string
CaCertPath string
PrivateKeyPath string
DiskPath string
CacheMode string
IOMode string
UserDataFile string
CloudConfigRoot string
LocalPorts string
MACAddress string
SocketVMNetPath string
SocketVMNetClientPath string
}
func (d *Driver) GetMachineName() string {
@ -447,9 +448,8 @@ func (d *Driver) Start() error {
// If socket network, start with socket_vmnet.
startProgram := d.Program
if d.Network == "socket_vmnet" {
startProgram = detect.SocketVMNetClientPath()
socketVMnetPath := detect.SocketVMNetPath()
startCmd = append([]string{socketVMnetPath, d.Program}, startCmd...)
startProgram = d.SocketVMNetClientPath
startCmd = append([]string{d.SocketVMNetPath, d.Program}, startCmd...)
}
if stdout, stderr, err := cmdOutErr(startProgram, startCmd...); err != nil {

View File

@ -143,25 +143,28 @@ func SocketVMNetInstalled() bool {
return SocketVMNetPath() != "" && SocketVMNetClientPath() != ""
}
// SocketVMNetPath returns the path of socket_vmnet
// SocketVMNetPath returns the path of socket_vmnet (QEMU driver only)
func SocketVMNetPath() string {
return checkSocketVMnetInstallLocations("socket-vmnet-path", "/var/run/socket_vmnet")
}
// SocketVMNetClientPath returns the path of socket_vmnet_client
func SocketVMNetClientPath() string {
return checkSocketVMnetInstallLocations("socket-vmnet-client-path", "/opt/socket_vmnet/bin/socket_vmnet_client")
}
// checkSocketVMnetInstallLocations accepts a flag name and relative file path
// if the flag value is non-empty, returns the flag value
// otherwise, checks the three possible socket_vmnet install locations for the binary
// if the binary is found it returns the full path, otherwise if returns an empty string
func checkSocketVMnetInstallLocations(flagName, path string) string {
p := viper.GetString(flagName)
p := viper.GetString("socket-vmnet-path")
if p != "" {
return p
}
return checkSocketVMNetInstallLocations("/var/run/socket_vmnet")
}
// SocketVMNetClientPath returns the path of socket_vmnet_client (QEMU driver only)
func SocketVMNetClientPath() string {
p := viper.GetString("socket-vmnet-client-path")
if p != "" {
return p
}
return checkSocketVMNetInstallLocations("/opt/socket_vmnet/bin/socket_vmnet_client")
}
// checkSocketVMNetInstallLocations accepts a relative file path
// checks the three possible socket_vmnet install locations for existance of the file path
// if the file path exists it returns the full path, otherwise if returns an empty string
func checkSocketVMNetInstallLocations(path string) string {
// source install, arm64 brew install, amd64 brew install
prefixes := []string{"", "/opt/homebrew", "/usr/local"}
for _, prefix := range prefixes {

View File

@ -170,23 +170,25 @@ func configure(cc config.ClusterConfig, n config.Node) (interface{}, error) {
StorePath: localpath.MiniPath(),
SSHUser: "docker",
},
Boot2DockerURL: download.LocalISOResource(cc.MinikubeISO),
DiskSize: cc.DiskSize,
Memory: cc.Memory,
CPU: cc.CPUs,
EnginePort: 2376,
FirstQuery: true,
DiskPath: filepath.Join(localpath.MiniPath(), "machines", name, fmt.Sprintf("%s.img", name)),
Program: qemuSystem,
BIOS: runtime.GOARCH != "arm64",
MachineType: qemuMachine,
CPUType: qemuCPU,
Firmware: qemuFirmware,
VirtioDrives: false,
Network: cc.Network,
CacheMode: "default",
IOMode: "threads",
MACAddress: mac,
Boot2DockerURL: download.LocalISOResource(cc.MinikubeISO),
DiskSize: cc.DiskSize,
Memory: cc.Memory,
CPU: cc.CPUs,
EnginePort: 2376,
FirstQuery: true,
DiskPath: filepath.Join(localpath.MiniPath(), "machines", name, fmt.Sprintf("%s.img", name)),
Program: qemuSystem,
BIOS: runtime.GOARCH != "arm64",
MachineType: qemuMachine,
CPUType: qemuCPU,
Firmware: qemuFirmware,
VirtioDrives: false,
Network: cc.Network,
CacheMode: "default",
IOMode: "threads",
MACAddress: mac,
SocketVMNetPath: cc.SocketVMnetPath,
SocketVMNetClientPath: cc.SocketVMnetClientPath,
}, nil
}

View File

@ -105,8 +105,8 @@ minikube start [flags]
--qemu-firmware-path string 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
--registry-mirror strings Registry mirrors to pass to the Docker daemon
--service-cluster-ip-range string The CIDR to be used for service cluster IPs. (default "10.96.0.0/12")
--socket-vmnet-client-path string Path to the socket vmnet client binary (default "/opt/socket_vmnet/bin/socket_vmnet_client")
--socket-vmnet-path string Path to socket vmnet binary (default "/var/run/socket_vmnet")
--socket-vmnet-client-path string Path to the socket vmnet client binary (QEMU driver only)
--socket-vmnet-path string Path to socket vmnet binary (QEMU driver only)
--ssh-ip-address string IP address (ssh driver only)
--ssh-key string SSH key (ssh driver only)
--ssh-port int SSH port (ssh driver only) (default 22)

View File

@ -470,10 +470,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "Überschreibe das Image, auch wenn ein Image mit dem gleichen Image:Tag-Namen existiert",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "Pfad des zu verwendenden Dockerfiles (optional)",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "",
"Paused {{.count}} containers": "{{.count}} Container pausiert",
"Paused {{.count}} containers in: {{.namespaces}}": "{{.count}} Container pausiert in: {{.namespaces}}",

View File

@ -477,10 +477,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "",
"Paused {{.count}} containers": "",
"Paused {{.count}} containers in: {{.namespaces}}": "",

View File

@ -458,9 +458,11 @@
"Outputs the licenses of dependencies to a directory": "Copie les licences des dépendances dans un répertoire",
"Overwrite image even if same image:tag name exists": "Écraser l'image même si la même image:balise existe",
"Path to socket vmnet binary": "Chemin d'accès au binaire socket vmnet",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "Chemin d'accès au Dockerfile à utiliser (facultatif)",
"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": "Chemin d'accès au fichier du micrologiciel qemu. Valeurs par défaut : pour Linux, l'emplacement du micrologiciel par défaut. Pour macOS, l'emplacement d'installation de brew. Pour Windows, C:\\Program Files\\qemu\\share",
"Path to the socket vmnet client binary": "Chemin d'accès au binaire socket vmnet",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "Pause",
"Paused {{.count}} containers": "{{.count}} conteneurs suspendus",
"Paused {{.count}} containers in: {{.namespaces}}": "{{.count}} conteneurs suspendus dans : {{.namespaces}}",

View File

@ -443,9 +443,11 @@
"Outputs the licenses of dependencies to a directory": "依存関係のライセンスをディレクトリーに出力します",
"Overwrite image even if same image:tag name exists": "同じ image:tag 名が存在していてもイメージを上書きします",
"Path to socket vmnet binary": "socket vmnet バイナリーへのパス",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "使用する Dockerfile へのパス (任意)",
"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": "qemu ファームウェアファイルへのパス。デフォルト: Linux の場合、デフォルトのファームウェアの場所。macOS の場合、brew のインストール場所。Windows の場合、C:\\Program Files\\qemu\\share",
"Path to the socket vmnet client binary": "socket vmnet クライアントバイナリーへのパス",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "一時停止",
"Paused {{.count}} containers": "{{.count}} 個のコンテナーを一時停止しました",
"Paused {{.count}} containers in: {{.namespaces}}": "{{.namespaces}} に存在する {{.count}} 個のコンテナーを一時停止しました",

View File

@ -490,10 +490,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "",
"Paused {{.count}} containers": "",
"Paused {{.count}} containers in: {{.namespaces}}": "",

View File

@ -484,10 +484,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "Nadpisuje obraz nawet jeśli istnieje obraz o tej samej nazwie i tagu.",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "Ścieżka pliku Dockerfile, którego należy użyć (opcjonalne)",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "Stop",
"Paused {{.count}} containers": "Zatrzymane kontenery: {{.count}}",
"Paused {{.count}} containers in: {{.namespaces}}": "Zatrzymane kontenery: {{.count}} w przestrzeniach nazw: {{.namespaces}}",

View File

@ -440,10 +440,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "",
"Paused {{.count}} containers": "",
"Paused {{.count}} containers in: {{.namespaces}}": "",

View File

@ -440,10 +440,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "",
"Paused {{.count}} containers": "",
"Paused {{.count}} containers in: {{.namespaces}}": "",

View File

@ -557,10 +557,10 @@
"Outputs minikube shell completion for the given shell (bash, zsh or fish)\n\n\tThis depends on the bash-completion binary. Example installation instructions:\n\tOS X:\n\t\t$ brew install bash-completion\n\t\t$ source $(brew --prefix)/etc/bash_completion\n\t\t$ minikube completion bash \u003e ~/.minikube-completion # for bash users\n\t\t$ minikube completion zsh \u003e ~/.minikube-completion # for zsh users\n\t\t$ source ~/.minikube-completion\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\tUbuntu:\n\t\t$ apt-get install bash-completion\n\t\t$ source /etc/bash_completion\n\t\t$ source \u003c(minikube completion bash) # for bash users\n\t\t$ source \u003c(minikube completion zsh) # for zsh users\n\t\t$ minikube completion fish \u003e ~/.config/fish/completions/minikube.fish # for fish users\n\n\tAdditionally, you may want to output the completion to a file and source in your .bashrc\n\n\tNote for zsh users: [1] zsh completions are only supported in versions of zsh \u003e= 5.2\n\tNote for fish users: [2] please refer to this docs for more details https://fishshell.com/docs/current/#tab-completion\n": "",
"Outputs the licenses of dependencies to a directory": "",
"Overwrite image even if same image:tag name exists": "",
"Path to socket vmnet binary": "",
"Path to socket vmnet binary (QEMU driver only)": "",
"Path to the Dockerfile to use (optional)": "",
"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": "",
"Path to the socket vmnet client binary": "",
"Path to the socket vmnet client binary (QEMU driver only)": "",
"Pause": "暂停",
"Paused kubelet and {{.count}} containers": "已暂停 kubelet 和 {{.count}} 个容器",
"Paused kubelet and {{.count}} containers in: {{.namespaces}}": "已暂停 {{.namespaces}} 中的 kubelet 和 {{.count}} 个容器",