From 19423258a4b6d2d7228708f3f0cce9a1bf7834d8 Mon Sep 17 00:00:00 2001 From: Rajat Chopra Date: Wed, 25 Feb 2026 16:04:51 -0800 Subject: [PATCH 1/2] feat: use an enable flag for whether GFD should be launched or not Signed-off-by: Rajat Chopra --- cmd/main.go | 7 +++++++ pkg/device_plugin/constants.go | 2 ++ pkg/device_plugin/device_plugin.go | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index 4154ae71..7f16b3ce 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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" @@ -43,5 +45,10 @@ func main() { if !ok { device_plugin.NVSwitchAlias = "nvswitch" } + enableGFDFlag, ok = os.LookupEnv("ENABLE_GFD") + // default is true + if ok { + device_plugin.EnableGFD, _ = strconv.ParseBool(enableGFDFlag) + } device_plugin.InitiateDevicePlugin() } diff --git a/pkg/device_plugin/constants.go b/pkg/device_plugin/constants.go index 5c6694fd..33d55c7b 100644 --- a/pkg/device_plugin/constants.go +++ b/pkg/device_plugin/constants.go @@ -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 = true ) func setCdiRoot(path string) { diff --git a/pkg/device_plugin/device_plugin.go b/pkg/device_plugin/device_plugin.go index 99cdbbb9..98a84785 100644 --- a/pkg/device_plugin/device_plugin.go +++ b/pkg/device_plugin/device_plugin.go @@ -133,7 +133,9 @@ func createDevicePlugins() { } // run GFD job - go runGFD() + if EnableGFD { + go runGFD() + } <-stop From 2c8deafafe8b6ac35170fe94bca4fea63ca3cd9a Mon Sep 17 00:00:00 2001 From: Rajat Chopra Date: Wed, 8 Apr 2026 11:28:44 -0700 Subject: [PATCH 2/2] the default GFD flag should be false --- cmd/main.go | 2 +- pkg/device_plugin/constants.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 7f16b3ce..35226f56 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -46,7 +46,7 @@ func main() { device_plugin.NVSwitchAlias = "nvswitch" } enableGFDFlag, ok = os.LookupEnv("ENABLE_GFD") - // default is true + // default is false if ok { device_plugin.EnableGFD, _ = strconv.ParseBool(enableGFDFlag) } diff --git a/pkg/device_plugin/constants.go b/pkg/device_plugin/constants.go index 33d55c7b..970522c5 100644 --- a/pkg/device_plugin/constants.go +++ b/pkg/device_plugin/constants.go @@ -47,7 +47,7 @@ var ( // cdiRoot can be set for testing to redirect CDI spec output cdiRoot = "/var/run/cdi" // Flag to allow running GFD pod - EnableGFD = true + EnableGFD = false ) func setCdiRoot(path string) {