Skip to content

Commit

Permalink
fix: enable pod attributes for gpu-sharing in gke (#433)
Browse files Browse the repository at this point in the history
We make a small fix to the Kubernetes PodMapper tranform processor.
Specifically we update the regular expression used in building the
device mapping to properly capture pod attributes in both MIG and
MIG-with-sharing GPUs in GKE.
  • Loading branch information
pintohutch authored Jan 13, 2025
1 parent 5f9250c commit 964ae23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/pkg/transformation/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import (
var (
connectionTimeout = 10 * time.Second

gkeMigDeviceIDRegex = regexp.MustCompile(`^nvidia([0-9]+)/gi([0-9]+)$`)
// Allow for MIG devices with or without GPU sharing to match in GKE.
gkeMigDeviceIDRegex = regexp.MustCompile(`^nvidia([0-9]+)/gi([0-9]+)(/vgpu[0-9]+)?$`)
gkeVirtualGPUDeviceIDSeparator = "/vgpu"
)

Expand Down
14 changes: 14 additions & 0 deletions internal/pkg/transformation/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ func TestProcessPodMapper_WithD_Different_Format_Of_DeviceID(t *testing.T) {
PODGPUID: "b8ea3855-276c-c9cb-b366-c6fa655957c5",
NvidiaResourceNames: []string{"nvidia.com/a100"},
},
{
KubernetesGPUIDType: appconfig.DeviceName,
ResourceName: appconfig.NvidiaResourceName,
MetricMigProfile: "1g.10gb",
GPUInstanceID: 0,
PODGPUID: "nvidia0/gi0/vgpu0",
},
{
KubernetesGPUIDType: appconfig.DeviceName,
ResourceName: appconfig.NvidiaResourceName,
MetricMigProfile: "1g.10gb",
GPUInstanceID: 1,
PODGPUID: "nvidia0/gi1/vgpu0",
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 964ae23

Please sign in to comment.