Remove KernelMemory option from /containers/create and /update endpoints
- remove KernelMemory option from `v1.42` api docs - remove KernelMemory warning on `/info` - update changes for `v1.42` - remove `KernelMemory` field from endpoints docs Signed-off-by: aiordache <anca.iordache@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7f99438ce7
commit
af6307fbda
5 changed files with 24 additions and 39 deletions
|
@ -439,6 +439,12 @@ func (s *containerRouter) postContainerUpdate(ctx context.Context, w http.Respon
|
|||
if versions.LessThan(httputils.VersionFromContext(ctx), "1.40") {
|
||||
updateConfig.PidsLimit = nil
|
||||
}
|
||||
|
||||
if versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.42") {
|
||||
// Ignore KernelMemory removed in API 1.42.
|
||||
updateConfig.KernelMemory = 0
|
||||
}
|
||||
|
||||
if updateConfig.PidsLimit != nil && *updateConfig.PidsLimit <= 0 {
|
||||
// Both `0` and `-1` are accepted to set "unlimited" when updating.
|
||||
// Historically, any negative value was accepted, so treat them as
|
||||
|
@ -505,6 +511,11 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
|
|||
}
|
||||
}
|
||||
|
||||
if hostConfig != nil && versions.GreaterThanOrEqualTo(version, "1.42") {
|
||||
// Ignore KernelMemory removed in API 1.42.
|
||||
hostConfig.KernelMemory = 0
|
||||
}
|
||||
|
||||
var platform *specs.Platform
|
||||
if versions.GreaterThanOrEqualTo(version, "1.41") {
|
||||
if v := r.Form.Get("platform"); v != "" {
|
||||
|
|
|
@ -577,17 +577,6 @@ definitions:
|
|||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/DeviceRequest"
|
||||
KernelMemory:
|
||||
description: |
|
||||
Kernel memory limit in bytes.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is deprecated as the kernel 5.4 deprecated
|
||||
> `kmem.limit_in_bytes`.
|
||||
type: "integer"
|
||||
format: "int64"
|
||||
example: 209715200
|
||||
KernelMemoryTCP:
|
||||
description: "Hard limit for kernel TCP buffer memory (in bytes)."
|
||||
type: "integer"
|
||||
|
@ -4657,16 +4646,6 @@ definitions:
|
|||
description: "Indicates if the host has memory swap limit support enabled."
|
||||
type: "boolean"
|
||||
example: true
|
||||
KernelMemory:
|
||||
description: |
|
||||
Indicates if the host has kernel memory limit support enabled.
|
||||
|
||||
<p><br /></p>
|
||||
|
||||
> **Deprecated**: This field is deprecated as the kernel 5.4 deprecated
|
||||
> `kmem.limit_in_bytes`.
|
||||
type: "boolean"
|
||||
example: true
|
||||
KernelMemoryTCP:
|
||||
description: |
|
||||
Indicates if the host has kernel memory TCP limit support enabled.
|
||||
|
@ -5834,7 +5813,6 @@ paths:
|
|||
Memory: 0
|
||||
MemorySwap: 0
|
||||
MemoryReservation: 0
|
||||
KernelMemory: 0
|
||||
NanoCpus: 500000
|
||||
CpuPercent: 80
|
||||
CpuShares: 512
|
||||
|
@ -6126,7 +6104,6 @@ paths:
|
|||
Memory: 0
|
||||
MemorySwap: 0
|
||||
MemoryReservation: 0
|
||||
KernelMemory: 0
|
||||
OomKillDisable: false
|
||||
OomScoreAdj: 500
|
||||
NetworkMode: "bridge"
|
||||
|
@ -6871,7 +6848,6 @@ paths:
|
|||
Memory: 314572800
|
||||
MemorySwap: 514288000
|
||||
MemoryReservation: 209715200
|
||||
KernelMemory: 52428800
|
||||
RestartPolicy:
|
||||
MaximumRetryCount: 4
|
||||
Name: "on-failure"
|
||||
|
|
|
@ -445,17 +445,16 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn
|
|||
// Kernel memory limit is not supported on cgroup v2.
|
||||
// Even on cgroup v1, kernel memory limit (`kmem.limit_in_bytes`) has been deprecated since kernel 5.4.
|
||||
// https://github.com/torvalds/linux/commit/0158115f702b0ba208ab0b5adf44cae99b3ebcc7
|
||||
warnings = append(warnings, "Specifying a kernel memory limit is deprecated and will be removed in a future release.")
|
||||
}
|
||||
if resources.KernelMemory > 0 && !sysInfo.KernelMemory {
|
||||
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.KernelMemory = 0
|
||||
}
|
||||
if resources.KernelMemory > 0 && resources.KernelMemory < linuxMinMemory {
|
||||
return warnings, fmt.Errorf("Minimum kernel memory limit allowed is 6MB")
|
||||
}
|
||||
if resources.KernelMemory > 0 && !kernel.CheckKernelVersion(4, 0, 0) {
|
||||
warnings = append(warnings, "You specified a kernel memory limit on a kernel older than 4.0. Kernel memory limits are experimental on older kernels, it won't work as expected and can cause your system to be unstable.")
|
||||
if !sysInfo.KernelMemory {
|
||||
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.KernelMemory = 0
|
||||
}
|
||||
if resources.KernelMemory < linuxMinMemory {
|
||||
return warnings, fmt.Errorf("Minimum kernel memory limit allowed is 6MB")
|
||||
}
|
||||
if !kernel.CheckKernelVersion(4, 0, 0) {
|
||||
warnings = append(warnings, "You specified a kernel memory limit on a kernel older than 4.0. Kernel memory limits are experimental on older kernels, it won't work as expected and can cause your system to be unstable.")
|
||||
}
|
||||
}
|
||||
if resources.OomKillDisable != nil && !sysInfo.OomKillDisable {
|
||||
// only produce warnings if the setting wasn't to *disable* the OOM Kill; no point
|
||||
|
|
|
@ -42,6 +42,9 @@ keywords: "API, Docker, rcli, REST, documentation"
|
|||
versioned, and affects all API versions if the daemon has this patch.
|
||||
* The `POST /containers/{id}/wait` endpoint now returns a `400` status code if an
|
||||
invalid `condition` is provided (on API 1.30 and up).
|
||||
* Removed the `KernelMemory` field from the `POST /containers/create` and
|
||||
`POST /containers/{id}/update` endpoints, any value it is set to will be ignored.
|
||||
This field has been deprecated in `v1.41`.
|
||||
|
||||
## v1.41 API changes
|
||||
|
||||
|
|
|
@ -149,10 +149,6 @@ func applyMemoryCgroupInfo(info *SysInfo) {
|
|||
if !info.MemorySwappiness {
|
||||
info.Warnings = append(info.Warnings, "Your kernel does not support memory swappiness")
|
||||
}
|
||||
info.KernelMemory = cgroupEnabled(mountPoint, "memory.kmem.limit_in_bytes")
|
||||
if !info.KernelMemory {
|
||||
info.Warnings = append(info.Warnings, "Your kernel does not support kernel memory limit")
|
||||
}
|
||||
info.KernelMemoryTCP = cgroupEnabled(mountPoint, "memory.kmem.tcp.limit_in_bytes")
|
||||
if !info.KernelMemoryTCP {
|
||||
info.Warnings = append(info.Warnings, "Your kernel does not support kernel memory TCP limit")
|
||||
|
|
Loading…
Reference in a new issue