mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 19:13:34 +00:00
refactor: cpu and memory under Resources struct
This commit is contained in:
+7
-10
@@ -1,14 +1,11 @@
|
||||
package api
|
||||
|
||||
type CPUResources struct {
|
||||
// Limit is the maximum amount of CPU nanocores (1000000000 = 1 CPU core) the container can use.
|
||||
Limit int64
|
||||
}
|
||||
|
||||
type MemoryResources struct {
|
||||
// Limit is the maximum amount of memory (in bytes) the container can use.
|
||||
Limit int64
|
||||
// Reservation is the minimum amount of memory (in bytes) the container needs to run efficiently.
|
||||
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.
|
||||
Reservation int64
|
||||
MemoryReservation int64
|
||||
}
|
||||
|
||||
+2
-4
@@ -162,8 +162,6 @@ func (s *ServiceSpec) Clone() ServiceSpec {
|
||||
type ContainerSpec struct {
|
||||
// Command overrides the default CMD of the image to be executed when running a container.
|
||||
Command []string
|
||||
// CPU resource allocation for the container.
|
||||
CPU CPUResources
|
||||
// Entrypoint overrides the default ENTRYPOINT of the image.
|
||||
Entrypoint []string
|
||||
// Env defines the environment variables to set inside the container.
|
||||
@@ -173,13 +171,13 @@ type ContainerSpec struct {
|
||||
Init *bool
|
||||
// LogDriver overrides the default logging driver for the container. Each Docker daemon can have its own default.
|
||||
LogDriver *LogDriver
|
||||
// Memory resource allocation for the container.
|
||||
Memory MemoryResources
|
||||
// Privileged gives extended privileges to the container. This is a security risk and should be used with caution.
|
||||
Privileged bool
|
||||
// PullPolicy determines when to pull the image from the registry or use the image already available in the cluster.
|
||||
// Default is PullPolicyMissing if empty.
|
||||
PullPolicy string
|
||||
// Resource allocation for the container.
|
||||
Resources ContainerResources
|
||||
// User overrides the default user of the image used to run the container. Format: user|UID[:group|GID].
|
||||
User string
|
||||
// VolumeMounts specifies how volumes are mounted into the container filesystem.
|
||||
|
||||
Reference in New Issue
Block a user