diff --git a/constants/constants.go b/constants/constants.go index 2f4b4f2..2a09077 100644 --- a/constants/constants.go +++ b/constants/constants.go @@ -40,7 +40,7 @@ var ( /* Devices */ devicesProhibited = []string{"eno", "eth", "lo", "docker", "flannel", "cni"} // interfaces we never add to a pool - devicesEnvVar = "AFXDP_DEVICES" // env var set in the end user application pod, lists AF_XDP devices attached + devicesEnvVarPrefix = "AFXDP_DEVICES_" // env var set in the end user application pod, lists AF_XDP devices attached deviceValidNameRegex = `^[a-zA-Z0-9_-]+$` // regex to check if a string is a valid device name deviceValidNameMin = 1 // minimum length of a device name deviceValidNameMax = 50 // maximum length of a device name @@ -286,7 +286,7 @@ func init() { Devices = devices{ Prohibited: devicesProhibited, - EnvVarList: devicesEnvVar, + EnvVarList: devicesEnvVarPrefix, ValidNameRegex: deviceValidNameRegex, ValidNameMin: deviceValidNameMin, ValidNameMax: deviceValidNameMax, diff --git a/internal/deviceplugin/poolManager.go b/internal/deviceplugin/poolManager.go index 1cbdebf..3952d07 100644 --- a/internal/deviceplugin/poolManager.go +++ b/internal/deviceplugin/poolManager.go @@ -277,11 +277,8 @@ func (pm *PoolManager) Allocate(ctx context.Context, } } - // MT this doesn't really work as the env var is being set per Allocate request - // Could leave the app to deduce the af_xdp device name from the path above - // or write the device name into a file in the same path as the xskmap - // or just drop altogher? - envs[constants.Devices.EnvVarList] = strings.Join(crqt.DevicesIDs[:], " ") + envVar := constants.Devices.EnvVarList + strings.ToUpper(pm.Name) + envs[envVar] = strings.Join(crqt.DevicesIDs[:], " ") envsPrint, err := tools.PrettyString(envs) if err != nil { logging.Errorf("Error printing container environment variables: %v", err)