Skip to content

Commit

Permalink
Merge pull request #9947 from glours/manage-resources-reservations
Browse files Browse the repository at this point in the history
add support of deploy.reservation.memory
  • Loading branch information
laurazard committed Nov 2, 2022
2 parents 6e2e19d + 7ba9aac commit df9e605
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/compose/create.go
Expand Up @@ -592,6 +592,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},
Expand Down

0 comments on commit df9e605

Please sign in to comment.