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

Allow the Docker driver to run containers with additional groups #8066

Closed
wants to merge 1 commit into from

Conversation

dnrce
Copy link

@dnrce dnrce commented May 27, 2020

This option is equivalent to docker run --group-add.


This is my first attempt at contributing to Nomad, my first contribution in Go anywhere, and in fact my first shot at doing anything in Go, period, so please be gentle. 🙂

A few questions, assuming this change is even directionally correct:

  • Have I covered all the areas that need changes?
  • Are these tests remotely sane?
  • Does this new option have the best name? I haven't thought extremely hard about alternatives but group_add didn't seem like the right fit. https://docs.docker.com/engine/reference/run/ describes the option as "Add additional groups to run as."
  • Is master the correct branch to target to get this into a near release?

Thanks!

@hashicorp-cla
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@gogococo
Copy link

I'm not going to do a code review as I'm not familiar enough with our code base, tests or Go at the moment.
Just wanted to drop in to say congrats, great job on putting together such a big first! Keep it up :)

@tgross tgross self-requested a review May 28, 2020 12:20
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

  • Have I covered all the areas that need changes?
  • Are these tests remotely sane?

Yup, this looks great! I really appreciate that you've also updated the docs (and that you even paid attention things like how the options were ordered in the docs!).

I've checked out this branch and run an example job with and without the config option and the resulting container has the expected GroupAdd config values. So from a technical standpoint this LGTM.

Does this new option have the best name? I haven't thought extremely hard about alternatives but group_add didn't seem like the right fit.

This is tough... my gut is to say that we want the config options for Docker to match the docker run flags as closely as possible, because then when folks see the option they can mentally map it easily. Which would suggest we should use group_add instead of additional_groups. But maybe @notnoop or @schmichael have a second opinion here though?

Is master the correct branch to target to get this into a near release?

Yes! We generally try to land everything on master, and then whomever merges this (probably me) will be responsible for cherry-picking into the next release branch as needed. We intentionally try to make that "not your problem" 😀


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

Choose a reason for hiding this comment

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

This whole if err != nil block can be reduced to require.NoError(t, err)

Copy link
Author

Choose a reason for hiding this comment

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

Copypasta -- updated.

@tgross
Copy link
Member

tgross commented May 28, 2020

Oh, and make sure you sign the CLA -- we'll need that done before we can merge this!

This option is equivalent to `docker run --group-add`.
@dnrce dnrce force-pushed the docker-group-add branch from 5b897bb to 268d14d Compare May 28, 2020 15:46
@dnrce
Copy link
Author

dnrce commented May 28, 2020

Thanks for the review!

This is tough... my gut is to say that we want the config options for Docker to match the docker run flags as closely as possible, because then when folks see the option they can mentally map it easily. Which would suggest we should use group_add instead of additional_groups.

I'm happy to update to whatever is decided. I'll also throw out added_groups as another possibility that splits the difference between the underlying Docker option name and the declarative format of the driver config.

Oh, and make sure you sign the CLA -- we'll need that done before we can merge this!

Noted -- I'm contributing as an Oracle employee here so I'm just checking internally to make sure all my ducks are in a row before I do.

@schmichael
Copy link
Member

schmichael commented Jun 29, 2020

Which would suggest we should use group_add instead of additional_groups. But maybe @notnoop or @schmichael have a second opinion here though?

For better or worse we try to match docker run, so +1 for group_add

I can't think of any security implications, but I'd love confirmation from someone else I'm not forgetting something.

(Also: thanks for the contribution! Great job!)

Base automatically changed from master to main March 8, 2021 19:25
@tgross
Copy link
Member

tgross commented Jun 9, 2022

It's been a little over two years without the CLA being signed on this, so I suspect it's safe to unfortunately close it out by now. If we want to implement this we may want to do it as a cleanroom implementation.

@tgross tgross closed this Jun 9, 2022
@github-actions
Copy link

github-actions bot commented Oct 8, 2022

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 Oct 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants