Skip to content
Merged
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
7 changes: 7 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ package main
import (
"github.com/nvidia/sandbox-device-plugin/pkg/device_plugin"
"os"
"strconv"
)

func main() {
var ok bool
var enableGFDFlag string
device_plugin.PGPUAlias, ok = os.LookupEnv("P_GPU_ALIAS")
if !ok {
device_plugin.PGPUAlias = "pgpu"
Expand All @@ -43,5 +45,10 @@ func main() {
if !ok {
device_plugin.NVSwitchAlias = "nvswitch"
}
enableGFDFlag, ok = os.LookupEnv("ENABLE_GFD")
// default is false
if ok {
device_plugin.EnableGFD, _ = strconv.ParseBool(enableGFDFlag)
}
device_plugin.InitiateDevicePlugin()
}
2 changes: 2 additions & 0 deletions pkg/device_plugin/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var (
rootPath = "/"
// cdiRoot can be set for testing to redirect CDI spec output
cdiRoot = "/var/run/cdi"
// Flag to allow running GFD pod
EnableGFD = false
)

func setCdiRoot(path string) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/device_plugin/device_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func createDevicePlugins() {
}

// run GFD job
go runGFD()
if EnableGFD {
go runGFD()
}

<-stop

Expand Down
Loading