diff --git a/go.mod b/go.mod index 4a944d8930..55e44f4576 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/Microsoft/go-winio v0.6.2 github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/buger/goterm v1.0.4 - github.com/compose-spec/compose-go/v2 v2.2.1-0.20241007090213-a59035ad2bf4 + github.com/compose-spec/compose-go/v2 v2.2.1-0.20241009124803-7218685580f7 github.com/containerd/containerd v1.7.22 github.com/containerd/platforms v0.2.1 github.com/davecgh/go-spew v1.1.1 diff --git a/go.sum b/go.sum index ca163141a4..c95e11cbcb 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/P github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= -github.com/compose-spec/compose-go/v2 v2.2.1-0.20241007090213-a59035ad2bf4 h1:2FWtPQWe/tkeGuwxk5x03luRw5pzPhPCRfzfeVw56vo= -github.com/compose-spec/compose-go/v2 v2.2.1-0.20241007090213-a59035ad2bf4/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc= +github.com/compose-spec/compose-go/v2 v2.2.1-0.20241009124803-7218685580f7 h1:AEhMR3gIC1HXWoM2KN9LK0P+Gm1NGWBVgflWD1BSnv4= +github.com/compose-spec/compose-go/v2 v2.2.1-0.20241009124803-7218685580f7/go.mod h1:lFN0DrMxIncJGYAXTfWuajfwj5haBJqrBkarHcnjJKc= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= diff --git a/pkg/compose/create.go b/pkg/compose/create.go index ba624a0a8b..f35af06137 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -668,6 +668,16 @@ func getDeployResources(s types.ServiceConfig) container.Resources { }) } + for _, gpus := range s.Gpus { + resources.DeviceRequests = append(resources.DeviceRequests, container.DeviceRequest{ + Driver: gpus.Driver, + Count: int(gpus.Count), + DeviceIDs: gpus.IDs, + Capabilities: [][]string{append(gpus.Capabilities, "gpu")}, + Options: gpus.Options, + }) + } + ulimits := toUlimits(s.Ulimits) resources.Ulimits = ulimits return resources