Skip to content

Commit 9deb531

Browse files
authored
Merge pull request #3947 from afbjorklund/hidden
Add explicit kvm2 flag for hidden KVM signature
2 parents 4ccc7a2 + 6491e35 commit 9deb531

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

Diff for: cmd/minikube/cmd/start.go

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const (
8484
vpnkitSock = "hyperkit-vpnkit-sock"
8585
vsockPorts = "hyperkit-vsock-ports"
8686
gpu = "gpu"
87+
hidden = "hidden"
8788
embedCerts = "embed-certs"
8889
noVTXCheck = "no-vtx-check"
8990
)
@@ -143,6 +144,7 @@ func init() {
143144
startCmd.Flags().String(vpnkitSock, "", "Location of the VPNKit socket used for networking. If empty, disables Hyperkit VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock.")
144145
startCmd.Flags().StringSlice(vsockPorts, []string{}, "List of guest VSock ports that should be exposed as sockets on the host (Only supported on with hyperkit now).")
145146
startCmd.Flags().Bool(gpu, false, "Enable experimental NVIDIA GPU support in minikube (works only with kvm2 driver on Linux)")
147+
startCmd.Flags().Bool(hidden, false, "Hide the hypervisor signature from the guest in minikube (works only with kvm2 driver on Linux)")
146148
startCmd.Flags().Bool(noVTXCheck, false, "Disable checking for the availability of hardware virtualization before the vm is started (virtualbox)")
147149
viper.BindPFlags(startCmd.Flags())
148150
RootCmd.AddCommand(startCmd)
@@ -238,6 +240,9 @@ func validateConfig() {
238240
if viper.GetBool(gpu) && viper.GetString(vmDriver) != "kvm2" {
239241
exit.Usage("Sorry, the --gpu feature is currently only supported with --vm-driver=kvm2")
240242
}
243+
if viper.GetBool(hidden) && viper.GetString(vmDriver) != "kvm2" {
244+
exit.Usage("Sorry, the --hidden feature is currently only supported with --vm-driver=kvm2")
245+
}
241246
}
242247

243248
// beginCacheImages caches Docker images in the background
@@ -303,6 +308,7 @@ func generateConfig(cmd *cobra.Command, k8sVersion string) (cfg.Config, error) {
303308
DisableDriverMounts: viper.GetBool(disableDriverMounts),
304309
UUID: viper.GetString(uuid),
305310
GPU: viper.GetBool(gpu),
311+
Hidden: viper.GetBool(hidden),
306312
NoVTXCheck: viper.GetBool(noVTXCheck),
307313
},
308314
KubernetesConfig: cfg.KubernetesConfig{

Diff for: pkg/drivers/kvm/domain.go

+2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ const domainTmpl = `
3636
<acpi/>
3737
<apic/>
3838
<pae/>
39+
{{if .Hidden}}
3940
<kvm>
4041
<hidden state='on'/>
4142
</kvm>
43+
{{end}}
4244
</features>
4345
<cpu mode='host-passthrough'/>
4446
<os>

Diff for: pkg/drivers/kvm/kvm.go

+3
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type Driver struct {
7474
// Whether to passthrough GPU devices from the host to the VM.
7575
GPU bool
7676

77+
// Whether to hide the KVM hypervisor signature from the guest
78+
Hidden bool
79+
7780
// XML that needs to be added to passthrough GPU devices.
7881
DevicesXML string
7982
}

Diff for: pkg/minikube/config/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type MachineConfig struct {
5252
NFSSharesRoot string
5353
UUID string // Only used by hyperkit to restore the mac address
5454
GPU bool // Only used by kvm2
55+
Hidden bool // Only used by kvm2
5556
NoVTXCheck bool // Only used by virtualbox
5657
}
5758

Diff for: pkg/minikube/drivers/kvm2/driver.go

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type kvmDriver struct {
5050
Boot2DockerURL string
5151
DiskPath string
5252
GPU bool
53+
Hidden bool
5354
}
5455

5556
func createKVM2Host(config cfg.MachineConfig) interface{} {
@@ -68,5 +69,6 @@ func createKVM2Host(config cfg.MachineConfig) interface{} {
6869
DiskPath: filepath.Join(constants.GetMinipath(), "machines", cfg.GetMachineName(), fmt.Sprintf("%s.rawdisk", cfg.GetMachineName())),
6970
ISO: filepath.Join(constants.GetMinipath(), "machines", cfg.GetMachineName(), "boot2docker.iso"),
7071
GPU: config.GPU,
72+
Hidden: config.Hidden,
7173
}
7274
}

0 commit comments

Comments
 (0)