From 7ba9aac5da8ce3b578f5339e735df84be99337a7 Mon Sep 17 00:00:00 2001 From: Guillaume Lours <705411+glours@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:51:57 +0200 Subject: [PATCH] add support of deploy.reservation.memory Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com> --- pkg/compose/create.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/compose/create.go b/pkg/compose/create.go index 9a57915ee..d2ef581dd 100644 --- a/pkg/compose/create.go +++ b/pkg/compose/create.go @@ -578,6 +578,12 @@ func setReservations(reservations *types.Resource, resources *container.Resource if reservations == nil { return } + // Cpu reservation is a swarm option and PIDs is only a limit + // So we only need to map memory reservation and devices + if reservations.MemoryBytes != 0 { + resources.MemoryReservation = int64(reservations.MemoryBytes) + } + for _, device := range reservations.Devices { resources.DeviceRequests = append(resources.DeviceRequests, container.DeviceRequest{ Capabilities: [][]string{device.Capabilities},