Skip to content

Add OOM adjustment flag to hostconfig via swarmctl cli - #3177

Merged
dperny merged 3 commits into
moby:masterfrom
psaintlaurent:ENGINE-903
Jun 11, 2024
Merged

Add OOM adjustment flag to hostconfig via swarmctl cli#3177
dperny merged 3 commits into
moby:masterfrom
psaintlaurent:ENGINE-903

Conversation

@psaintlaurent

Copy link
Copy Markdown
Contributor

- What I did
Add kernel level tuning flag for OOM adjustment to hostconfig via swarmctl cli

- How I did it
I added flags to swarmctl modified the API to include oom-score-adj flag.

- How to test it

After starting swarmd, run

swarmctl service create --name <service_name> --oom-score-adj --image <image_name>

Verify oom-score-adj works correctly by inspecting the container

docker container inspect <container_name>

The Hostconfig, OomScoreAdj value should be set to the value you specified via swarmctl

- Description for the changelog
Add OOM adjustment flag to hostconfig via swarmctl cli

corhere and others added 2 commits June 5, 2024 13:55
The module path for swarmd is not valid for the location of the swarmd
module within the swarmkit repo. The go command resolves package paths
to the swarmkit/v2 module and fails when the packages don't exist.

    $ go run github.com/moby/swarmkit/v2/swarmd/cmd/swarm-rafttool@master
    go: github.com/moby/swarmkit/v2/swarmd/cmd/swarm-rafttool@master: module github.com/moby/swarmkit/v2@master found (v2.0.0-20240227173239-911c97650f2e), but does not contain package github.com/moby/swarmkit/v2/swarmd/cmd/swarm-rafttool

(This is only a problem when swarmd is not the main module.)

Fix the swarmd module's path to align with the module source location so
that `go run` can once again be used to invoke swarm-rafttool and the
other commands.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Signed-off-by: plaurent <patrick@saint-laurent.us>
Signed-off-by: plaurent <patrick@saint-laurent.us>
Comment thread api/types.proto Outdated
Resources limits = 1;
Resources reservations = 2;


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unnecessary edits in this file.

Comment thread api/specs.proto
// is equivalent to passing --ulimit to docker run.
repeated Ulimit ulimits = 29;

int64 oom_score_adj = 30;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add a comment, in the fashion of the comments above, explaining what the field does. These end up as godoc comments, so the comment should start with something like

// OomScoreAdj <sets/defines/verbs>

Signed-off-by: plaurent <patrick@saint-laurent.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants