fix gpus flag not getting passed to docker

pull/17314/head
Steven Powell 2023-09-27 13:37:27 -07:00
parent 7f5fbf98fe
commit 311630cea9
3 changed files with 3 additions and 2 deletions

View File

@ -1449,7 +1449,7 @@ func validateEnableNvidiaGPUs(gpusEnabled bool, drvName, rtime string) error {
if !gpusEnabled {
return nil
}
if drvName == constants.Docker && rtime == constants.Docker {
if drvName == constants.Docker && (rtime == constants.Docker || rtime == constants.DefaultContainerRuntime) {
return nil
}
return errors.Errorf("The enable-nvidia-gpus flag can only be run with the docker driver and docker container-runtime")

View File

@ -453,7 +453,7 @@ func (d *Driver) Stop() error {
}
}
runtime, err := cruntime.New(cruntime.Config{Type: d.NodeConfig.ContainerRuntime, Runner: d.exec, EnableNvidiaGPUs: d.NodeConfig.EnableNvidiaGPUs})
runtime, err := cruntime.New(cruntime.Config{Type: d.NodeConfig.ContainerRuntime, Runner: d.exec})
if err != nil { // won't return error because:
// even though we can't stop the cotainers inside, we still wanna stop the minikube container itself
klog.Errorf("unable to get container runtime: %v", err)

View File

@ -394,6 +394,7 @@ func configureRuntimes(runner cruntime.CommandRunner, cc config.ClusterConfig, k
ImageRepository: cc.KubernetesConfig.ImageRepository,
KubernetesVersion: kv,
InsecureRegistry: cc.InsecureRegistry,
EnableNvidiaGPUs: cc.EnableNvidiaGPUs,
}
cr, err := cruntime.New(co)
if err != nil {