Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OOM adjustment flag to hostconfig via swarmctl cli #3177

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

psaintlaurent
Copy link
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>
api/types.proto Outdated
@@ -80,6 +80,7 @@ message ResourceRequirements {
Resources limits = 1;
Resources reservations = 2;


Copy link
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.

@@ -370,6 +372,8 @@ message ContainerSpec {
// Ulimits defines the list of ulimits to set in the container. This option
// is equivalent to passing --ulimit to docker run.
repeated Ulimit ulimits = 29;

int64 oom_score_adj = 30;
Copy link
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>
@dperny dperny merged commit ea1a7ce into moby:master Jun 11, 2024
9 checks passed
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.

None yet

3 participants