Selaa lähdekoodia

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

add support of deploy.reservation.memory
Laura Brehm 3 vuotta sitten
vanhempi
sitoutus
df9e605b31
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      pkg/compose/create.go

+ 6 - 0
pkg/compose/create.go

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