Merge pull request #9947 from glours/manage-resources-reservations

add support of deploy.reservation.memory
This commit is contained in:
Laura Brehm 2022-11-02 16:09:14 +01:00 committed by GitHub
commit df9e605b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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},