forked from LaconicNetwork/kompose
update compose-go to 2.1.0
Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
This commit is contained in:
parent
e4ca58bcf2
commit
17ec585065
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.21
|
||||
toolchain go1.21.8
|
||||
|
||||
require (
|
||||
github.com/compose-spec/compose-go/v2 v2.0.0-rc.8
|
||||
github.com/compose-spec/compose-go/v2 v2.1.0
|
||||
github.com/deckarep/golang-set v1.8.0
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/fsouza/go-dockerclient v1.9.7
|
||||
|
||||
2
go.sum
2
go.sum
@ -58,6 +58,8 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/compose-spec/compose-go/v2 v2.0.0-rc.8 h1:b7l+GqFF+2W4M4kLQUDRTGhqmTiRwT3bYd9X7xrxp5Q=
|
||||
github.com/compose-spec/compose-go/v2 v2.0.0-rc.8/go.mod h1:bEPizBkIojlQ20pi2vNluBa58tevvj0Y18oUSHPyfdc=
|
||||
github.com/compose-spec/compose-go/v2 v2.1.0 h1:qdW2qISQlCQG8v1O2TChcdxgAWTUGgUX/CPSO+ES9+E=
|
||||
github.com/compose-spec/compose-go/v2 v2.1.0/go.mod h1:bEPizBkIojlQ20pi2vNluBa58tevvj0Y18oUSHPyfdc=
|
||||
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=
|
||||
github.com/containerd/containerd v1.6.26 h1:VVfrE6ZpyisvB1fzoY8Vkiq4sy+i5oF4uk7zu03RaHs=
|
||||
github.com/containerd/containerd v1.6.26/go.mod h1:I4TRdsdoo5MlKob5khDJS2EPT1l1oMNaE2MBm6FrwxM=
|
||||
|
||||
@ -653,23 +653,15 @@ func parseResources(composeServiceConfig *types.ServiceConfig, serviceConfig *ko
|
||||
if composeServiceConfig.Deploy.Resources.Limits != nil {
|
||||
serviceConfig.MemLimit = composeServiceConfig.Deploy.Resources.Limits.MemoryBytes
|
||||
|
||||
if composeServiceConfig.Deploy.Resources.Limits.NanoCPUs != "" {
|
||||
cpuLimit, err := strconv.ParseFloat(composeServiceConfig.Deploy.Resources.Limits.NanoCPUs, 64)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Unable to convert cpu limits resources value")
|
||||
}
|
||||
serviceConfig.CPULimit = int64(cpuLimit * 1000)
|
||||
if composeServiceConfig.Deploy.Resources.Limits.NanoCPUs > 0 {
|
||||
serviceConfig.CPULimit = int64(composeServiceConfig.Deploy.Resources.Limits.NanoCPUs * 1000)
|
||||
}
|
||||
}
|
||||
if composeServiceConfig.Deploy.Resources.Reservations != nil {
|
||||
serviceConfig.MemReservation = composeServiceConfig.Deploy.Resources.Reservations.MemoryBytes
|
||||
|
||||
if composeServiceConfig.Deploy.Resources.Reservations.NanoCPUs != "" {
|
||||
cpuReservation, err := strconv.ParseFloat(composeServiceConfig.Deploy.Resources.Reservations.NanoCPUs, 64)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Unable to convert cpu limits reservation value")
|
||||
}
|
||||
serviceConfig.CPUReservation = int64(cpuReservation * 1000)
|
||||
if composeServiceConfig.Deploy.Resources.Reservations.NanoCPUs > 0 {
|
||||
serviceConfig.CPUReservation = int64(composeServiceConfig.Deploy.Resources.Reservations.NanoCPUs * 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user