Skip to content

Commit aa2d71d

Browse files
authored
fix: remove nvidia.com/gpu resource requests and limits from containers (#140)
1 parent 4b57ac2 commit aa2d71d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/constants/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ package constants
22

33
import "time"
44

5+
const (
6+
NvidiaGPUKey = "nvidia.com/gpu"
7+
)
58
const (
69
// Domain is the domain prefix used for all tensor-fusion.ai related annotations and finalizers
710
Domain = "tensor-fusion.ai"

internal/webhook/v1/pod_webhook.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,14 @@ func (m *TensorFusionPodMutator) patchTFClient(
255255
return nil, fmt.Errorf("unmarshal patched container: %w", err)
256256
}
257257

258+
// remove nvidia.com/gpu in resources
259+
if container.Resources.Requests != nil {
260+
delete(container.Resources.Requests, constants.NvidiaGPUKey)
261+
}
262+
if container.Resources.Limits != nil {
263+
delete(container.Resources.Limits, constants.NvidiaGPUKey)
264+
}
265+
258266
// add connection env
259267
connectionName := fmt.Sprintf("%s%s", pod.GenerateName, shortuuid.NewWithAlphabet("123456789abcdefghijkmnopqrstuvwxy"))
260268
connectionNamespace := pod.Namespace

0 commit comments

Comments
 (0)