Skip to content

Remove the deprecated '--kernel-memory' option on API v1.42 and up#43214

Merged
AkihiroSuda merged 3 commits intomoby:masterfrom
thaJeztah:carry_42854_rm_options
Mar 17, 2022
Merged

Remove the deprecated '--kernel-memory' option on API v1.42 and up#43214
AkihiroSuda merged 3 commits intomoby:masterfrom
thaJeztah:carry_42854_rm_options

Conversation

@thaJeztah
Copy link
Member

closes #42854

Add missing KernelMemoryTCP to docs (for /info endpoint)

Update handling of deprecated kernel (tcp) memory options

  • Omit KernelMemory and KernelMemoryTCP fields in /info response if they're
    not supported, or when using API v1.42 or up.
  • Re-enable detection of KernelMemory (as it's still needed for older API versions)
  • Remove warning about kernel memory TCP in daemon logs (a warning is still returned
    by the /info endpoint, but we can consider removing that).
  • Prevent incorrect "Minimum kernel memory limit allowed" error if the value was
    reset because it's not supported by the host.

api/types: fix KernelMemory deprecation comment, and omitempty


Ignore the kernel memory option if set in HostConfig on container create.
We keep the option in the API ( for the containers/create and /info endpoints) until the next API version release but ignore any value it is set to.

root@80b7d3e03521:~# curl --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -d '{"Image": "alpine", "Cmd": ["echo", "hello world"], "HostConfig": {"KernelMemory": 299900}}' -X POST http://localhost/v1.41/containers/create
{"Id":"4d8537d9cee548938492d489b7d8394b46ae75992d89875fbf2b33971762a552","Warnings":["Specifying a kernel memory limit is not supported anymore."]}
root@80b7d3e03521:~# docker inspect 4d8537d9cee5
[
    {
        "Id": "4d8537d9cee548938492d489b7d8394b46ae75992d89875fbf2b33971762a552",
....
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
....

root@80b7d3e03521:~# curl -s --unix-socket /var/run/docker.sock http://localhost/info | jq .| grep KernelMemory
  "KernelMemoryTCP": false,

@thaJeztah thaJeztah added this to the 21.xx milestone Feb 14, 2022
@thaJeztah
Copy link
Member Author

@AkihiroSuda ptal

@inosgun

This comment was marked as spam.

@thaJeztah
Copy link
Member Author

Extracted the first 3 commits to #43277

@thaJeztah thaJeztah force-pushed the carry_42854_rm_options branch from 0ad089a to 3322447 Compare March 3, 2022 18:35
@thaJeztah
Copy link
Member Author

thaJeztah commented Mar 3, 2022

Hmm. failure on Microsoft's registry 😅 ;

INFO: Pulling mcr.microsoft.com/windows/servercore:ltsc2022 from docker hub into daemon under test. This may take some time...
[2022-03-03T18:52:32.643Z] powershell.exe : Error response from daemon: Get "https://mcr.microsoft.com/v2/windows/servercore/manifests/sha256:720729320e08bdf14b6bc16444be6a3b74a457bd0584fee5124e6073e9f8f1cf: dial tcp 
[2022-03-03T18:52:32.643Z] 131.253.33.219:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host

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
on API version `v1.41` and up. Older API versions still accept this field, but
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be v1.42 and up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, dang! Yes, let me fix that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed 👍 PTAL

aiordache and others added 3 commits March 17, 2022 09:55
 - 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>
- Omit `KernelMemory` and `KernelMemoryTCP` fields in `/info` response if they're
  not supported, or when using API v1.42 or up.
- Re-enable detection of `KernelMemory` (as it's still needed for older API versions)
- Remove warning about kernel memory TCP in daemon logs (a warning is still returned
  by the `/info` endpoint, but we can consider removing that).
- Prevent incorrect "Minimum kernel memory limit allowed" error if the value was
  reset because it's not supported by the host.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This fixes the "deprecated" comment to have the correct format to be picked
up by editors, and adds `omitempty` labels for KernelMemory and KernelMemoryTCP.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the carry_42854_rm_options branch from 3322447 to 427b0cd Compare March 17, 2022 08:56
Copy link
Member

@rumpl rumpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkihiroSuda
Copy link
Member

LGTM, but maybe we should print some warning when --kernel-memory was specified?

@thaJeztah
Copy link
Member Author

but maybe we should print some warning when --kernel-memory was specified?

Perhaps we could do something yes; need to think a bit what logic to use for that warning;

  • --kernel-memory will be deprecated/hidden on the CLI (based on the API version used), so we'll likely print a warning on that side
  • if an older API version is used, but a value is set, we could indeed print a warning that the runtime may ignore the option

For the second case, we could propagate the Warnings in the container create response

Are you OK with me doing that in a follow-up?

@AkihiroSuda
Copy link
Member

Are you OK with me doing that in a follow-up?

Yes 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants