From 26f687a12b67fb344148ec045f81a3de43b52f0b Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Thu, 21 Mar 2024 13:43:22 -0400 Subject: [PATCH] Revert "Bump compose-go to v2.0.1" This reverts commit ad414613090d031583181d34cf93f15024d0524c. Signed-off-by: Milas Bowman --- go.mod | 2 +- go.sum | 4 ++-- pkg/compose/create.go | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index c46be99a7..2103cdd57 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/Microsoft/go-winio v0.6.1 github.com/buger/goterm v1.0.4 - github.com/compose-spec/compose-go/v2 v2.0.1 + github.com/compose-spec/compose-go/v2 v2.0.0 github.com/containerd/console v1.0.3 github.com/containerd/containerd v1.7.12 github.com/davecgh/go-spew v1.1.1 diff --git a/go.sum b/go.sum index 567ba9ba0..cfb3e697b 100644 --- a/go.sum +++ b/go.sum @@ -86,8 +86,8 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+g github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 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.0.1 h1:XIvwK9RltlwAikI1d8aOaGGTr0/i2Jev3LoRn2nLEmA= -github.com/compose-spec/compose-go/v2 v2.0.1/go.mod h1:bEPizBkIojlQ20pi2vNluBa58tevvj0Y18oUSHPyfdc= +github.com/compose-spec/compose-go/v2 v2.0.0 h1:RLI8GmNxRLg759CzZITh/kGYZTYhEak121FaVYdXTC8= +github.com/compose-spec/compose-go/v2 v2.0.0/go.mod h1:bEPizBkIojlQ20pi2vNluBa58tevvj0Y18oUSHPyfdc= 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.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= diff --git a/pkg/compose/create.go b/pkg/compose/create.go index c1227486e..241ab1f40 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -710,8 +710,10 @@ func setLimits(limits *types.Resource, resources *container.Resources) { if limits.MemoryBytes != 0 { resources.Memory = int64(limits.MemoryBytes) } - if limits.NanoCPUs != 0 { - resources.NanoCPUs = int64(limits.NanoCPUs * 1e9) + if limits.NanoCPUs != "" { + if f, err := strconv.ParseFloat(limits.NanoCPUs, 64); err == nil { + resources.NanoCPUs = int64(f * 1e9) + } } if limits.Pids > 0 { resources.PidsLimit = &limits.Pids