Allow negative value for some resource fields
Carry #499 For these values, cgroup kernal APIs accept -1 to set them as unlimited, as docker and runc all support update resources, we should not set drawbacks in spec. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
ced3365b4d
commit
082e93a2bd
|
@ -283,15 +283,15 @@ For more information, see [the memory cgroup man page][cgroup-v1-memory].
|
||||||
|
|
||||||
The following parameters can be specified to setup the controller:
|
The following parameters can be specified to setup the controller:
|
||||||
|
|
||||||
* **`limit`** *(uint64, OPTIONAL)* - sets limit of memory usage in bytes
|
* **`limit`** *(int64, OPTIONAL)* - sets limit of memory usage in bytes
|
||||||
|
|
||||||
* **`reservation`** *(uint64, OPTIONAL)* - sets soft limit of memory usage in bytes
|
* **`reservation`** *(int64, OPTIONAL)* - sets soft limit of memory usage in bytes
|
||||||
|
|
||||||
* **`swap`** *(uint64, OPTIONAL)* - sets limit of memory+Swap usage
|
* **`swap`** *(int64, OPTIONAL)* - sets limit of memory+Swap usage
|
||||||
|
|
||||||
* **`kernel`** *(uint64, OPTIONAL)* - sets hard limit for kernel memory
|
* **`kernel`** *(int64, OPTIONAL)* - sets hard limit for kernel memory
|
||||||
|
|
||||||
* **`kernelTCP`** *(uint64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
|
* **`kernelTCP`** *(int64, OPTIONAL)* - sets hard limit in bytes for kernel TCP buffer memory
|
||||||
|
|
||||||
* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
|
* **`swappiness`** *(uint64, OPTIONAL)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
|
||||||
|
|
||||||
|
@ -317,11 +317,11 @@ The following parameters can be specified to setup the controller:
|
||||||
|
|
||||||
* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
|
* **`shares`** *(uint64, OPTIONAL)* - specifies a relative share of CPU time available to the tasks in a cgroup
|
||||||
|
|
||||||
* **`quota`** *(uint64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
|
* **`quota`** *(int64, OPTIONAL)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
|
||||||
|
|
||||||
* **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only)
|
* **`period`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (CFS scheduler only)
|
||||||
|
|
||||||
* **`realtimeRuntime`** *(uint64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
|
* **`realtimeRuntime`** *(int64, OPTIONAL)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
|
||||||
|
|
||||||
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
|
* **`realtimePeriod`** *(uint64, OPTIONAL)* - same as **`period`** but applies to realtime scheduler only
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ Each entry has the following structure:
|
||||||
|
|
||||||
* **`pageSize`** *(string, REQUIRED)* - hugepage size
|
* **`pageSize`** *(string, REQUIRED)* - hugepage size
|
||||||
|
|
||||||
* **`limit`** *(uint64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
|
* **`limit`** *(int64, REQUIRED)* - limit in bytes of *hugepagesize* HugeTLB usage
|
||||||
|
|
||||||
###### Example
|
###### Example
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ Each entry has the following structure:
|
||||||
"hugepageLimits": [
|
"hugepageLimits": [
|
||||||
{
|
{
|
||||||
"pageSize": "2MB",
|
"pageSize": "2MB",
|
||||||
"limit": 9223372036854771712
|
"limit": 209715200
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
},
|
},
|
||||||
"quota": {
|
"quota": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/quota",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"realtimePeriod": {
|
"realtimePeriod": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimePeriod",
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
},
|
},
|
||||||
"realtimeRuntime": {
|
"realtimeRuntime": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/realtimeRuntime",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"shares": {
|
"shares": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/cpu/shares",
|
||||||
|
@ -220,7 +220,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"$ref": "defs.json#/definitions/uint64"
|
"$ref": "defs.json#/definitions/int64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,19 +236,19 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"kernel": {
|
"kernel": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/kernel",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"limit": {
|
"limit": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/limit",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"reservation": {
|
"reservation": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/reservation",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"swap": {
|
"swap": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swap",
|
||||||
"$ref": "defs.json#/definitions/uint64Pointer"
|
"$ref": "defs.json#/definitions/int64Pointer"
|
||||||
},
|
},
|
||||||
"swappiness": {
|
"swappiness": {
|
||||||
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
|
"id": "https://opencontainers.org/schema/bundle/linux/resources/memory/swappiness",
|
||||||
|
|
|
@ -210,7 +210,7 @@ type LinuxHugepageLimit struct {
|
||||||
// Pagesize is the hugepage size
|
// Pagesize is the hugepage size
|
||||||
Pagesize string `json:"pageSize"`
|
Pagesize string `json:"pageSize"`
|
||||||
// Limit is the limit of "hugepagesize" hugetlb usage
|
// Limit is the limit of "hugepagesize" hugetlb usage
|
||||||
Limit uint64 `json:"limit"`
|
Limit int64 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LinuxInterfacePriority for network interfaces
|
// LinuxInterfacePriority for network interfaces
|
||||||
|
@ -266,15 +266,15 @@ type LinuxBlockIO struct {
|
||||||
// LinuxMemory for Linux cgroup 'memory' resource management
|
// LinuxMemory for Linux cgroup 'memory' resource management
|
||||||
type LinuxMemory struct {
|
type LinuxMemory struct {
|
||||||
// Memory limit (in bytes).
|
// Memory limit (in bytes).
|
||||||
Limit *uint64 `json:"limit,omitempty"`
|
Limit *int64 `json:"limit,omitempty"`
|
||||||
// Memory reservation or soft_limit (in bytes).
|
// Memory reservation or soft_limit (in bytes).
|
||||||
Reservation *uint64 `json:"reservation,omitempty"`
|
Reservation *int64 `json:"reservation,omitempty"`
|
||||||
// Total memory limit (memory + swap).
|
// Total memory limit (memory + swap).
|
||||||
Swap *uint64 `json:"swap,omitempty"`
|
Swap *int64 `json:"swap,omitempty"`
|
||||||
// Kernel memory limit (in bytes).
|
// Kernel memory limit (in bytes).
|
||||||
Kernel *uint64 `json:"kernel,omitempty"`
|
Kernel *int64 `json:"kernel,omitempty"`
|
||||||
// Kernel memory limit for tcp (in bytes)
|
// Kernel memory limit for tcp (in bytes)
|
||||||
KernelTCP *uint64 `json:"kernelTCP,omitempty"`
|
KernelTCP *int64 `json:"kernelTCP,omitempty"`
|
||||||
// How aggressive the kernel will swap memory pages. Range from 0 to 100.
|
// How aggressive the kernel will swap memory pages. Range from 0 to 100.
|
||||||
Swappiness *uint64 `json:"swappiness,omitempty"`
|
Swappiness *uint64 `json:"swappiness,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -284,11 +284,11 @@ type LinuxCPU struct {
|
||||||
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
|
// CPU shares (relative weight (ratio) vs. other cgroups with cpu shares).
|
||||||
Shares *uint64 `json:"shares,omitempty"`
|
Shares *uint64 `json:"shares,omitempty"`
|
||||||
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
|
// CPU hardcap limit (in usecs). Allowed cpu time in a given period.
|
||||||
Quota *uint64 `json:"quota,omitempty"`
|
Quota *int64 `json:"quota,omitempty"`
|
||||||
// CPU period to be used for hardcapping (in usecs).
|
// CPU period to be used for hardcapping (in usecs).
|
||||||
Period *uint64 `json:"period,omitempty"`
|
Period *uint64 `json:"period,omitempty"`
|
||||||
// How much time realtime scheduling may use (in usecs).
|
// How much time realtime scheduling may use (in usecs).
|
||||||
RealtimeRuntime *uint64 `json:"realtimeRuntime,omitempty"`
|
RealtimeRuntime *int64 `json:"realtimeRuntime,omitempty"`
|
||||||
// CPU period to be used for realtime scheduling (in usecs).
|
// CPU period to be used for realtime scheduling (in usecs).
|
||||||
RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
|
RealtimePeriod *uint64 `json:"realtimePeriod,omitempty"`
|
||||||
// CPUs to use within the cpuset. Default is to use any CPU available.
|
// CPUs to use within the cpuset. Default is to use any CPU available.
|
||||||
|
|
Loading…
Reference in New Issue