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

Rebase and merge of docker sysctl support #3568

Merged
merged 12 commits into from
Nov 20, 2017
Merged

Rebase and merge of docker sysctl support #3568

merged 12 commits into from
Nov 20, 2017

Conversation

preetapan
Copy link
Member

No description provided.

@commarla
Copy link

commarla commented Nov 18, 2017

Thanks a lot @preetapan . I really need this one!

@@ -75,6 +75,7 @@ The `docker` driver supports the following configuration in the job spec. Only
}
```

<<<<<<< 657619c0ec51068e48a34817ddc4df267b6cce6f
Copy link
Contributor

Choose a reason for hiding this comment

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

left-over merge conflict marker

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 now

splitted := strings.SplitN(ulimitRaw, ":", 2)
soft, err := strconv.Atoi(splitted[0])
if err != nil {
return []docker.ULimit{}, fmt.Errorf("Malformed ulimit %v: %v", name, ulimitRaw)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe include that it's the soft limit that is invalid? - same below for hard limit

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed with the limit specification for logging.

}

splitted := strings.SplitN(ulimitRaw, ":", 2)
soft, err := strconv.Atoi(splitted[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

Check length before indexing.

splitted := strings.SplitN(ulimitRaw, ":", 2)
soft, err := strconv.Atoi(splitted[0])
if err != nil {
return []docker.ULimit{}, fmt.Errorf("Malformed ulimit %v: %v", name, ulimitRaw)
Copy link
Contributor

Choose a reason for hiding this comment

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

agreed with the limit specification for logging.

if err != nil {
return []docker.ULimit{}, fmt.Errorf("Malformed ulimit %v: %v", name, ulimitRaw)
}
hard, err := strconv.Atoi(splitted[1])
Copy link
Contributor

Choose a reason for hiding this comment

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

Check limit before indexing.


container, err := client.InspectContainer(handle.ContainerID())
if err != nil {
t.Fatalf("err: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use assert library for test assertions.

@@ -97,6 +97,34 @@ The `docker` driver supports the following configuration in the job spec. Only
* `interactive` - (Optional) `true` or `false` (default). Keep STDIN open on
the container.

* `sysctl` - (Optional) A key-value map of sysctl configurations to set to the
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence is incomplete.

@@ -858,6 +858,60 @@ func TestDockerDriver_NetworkAliases_Bridge(t *testing.T) {
}
}

func TestDockerDriver_Sysctl_Ulimit(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we test the failure conditions as well?

Copy link
Contributor

@chelseakomlo chelseakomlo left a comment

Choose a reason for hiding this comment

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

Looks good! If you can just swap to use assert in the error case test.

defer ctx.AllocDir.Destroy()

if _, err := driver.Prestart(ctx.ExecCtx, task); err == nil || err.Error() != tc.err.Error() {
t.Fatalf("error expected in prestart, got %v, expected %v", err, tc.err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Use assert here :)

@preetapan preetapan merged commit 7ef8440 into master Nov 20, 2017
@preetapan preetapan deleted the f-docker-sysctl branch November 20, 2017 20:02
@ashald
Copy link

ashald commented Nov 21, 2017

Is there any plans for supporting this for rkt?

@dadgar
Copy link
Contributor

dadgar commented Dec 6, 2017

@ashald Looks like there isn't support yet: rkt/rkt#2694

@ashald
Copy link

ashald commented Dec 11, 2017

Sorry, missed that!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants