Files
uncloud/pkg/api/resources.go
T
Justin BradfordandGitHub 3b4bcb7932 feat: support service.gpus and reservations.devices (#156)
* feat: support compose.yaml `service.gpus` and `service.deploy.resources.reservations.devices` DeviceRequests to Docker container
* Fix lint error
* Adjust test comments to work with linter
* Rename DeviceRequests to DeviceReservations to be more consistent with compose nomenclature
* Device reservation changes are immutable and should trigger a container recreate rather than update
2025-10-27 16:49:38 +10:00

23 lines
695 B
Go

package api
import (
"github.com/docker/docker/api/types/container"
)
const (
MilliCore = 1_000_000
Core = 1000 * MilliCore
)
type ContainerResources struct {
// CPU is the maximum amount of CPU nanocores (1000000000 = 1 CPU core) the container can use.
CPU int64
// Memory is the maximum amount of memory (in bytes) the container can use.
Memory int64
// MemoryReservation is the minimum amount of memory (in bytes) the container needs to run efficiently.
// TODO: implement a placement constraint that checks available memory on machines.
MemoryReservation int64
// Device reservations/requests for access to things like GPUs
DeviceReservations []container.DeviceRequest
}