瀏覽代碼

add support of deploy.reservation.memory

Signed-off-by: Guillaume Lours <[email protected]>
Guillaume Lours 3 年之前
父節點
當前提交
7ba9aac5da
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      pkg/compose/create.go

+ 6 - 0
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},