Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

[WIP] Attach lxc containers to lxcbr0 by configuring a new network_mode parameter #13

Merged
merged 5 commits into from
Jul 8, 2020

Conversation

towe75
Copy link
Contributor

@towe75 towe75 commented Jun 28, 2019

A new driver parameter "network_mode" switches the behavior of the containers network interface.
The default value "bridge", will attach the container to the standard "lxcbr0" bridge. A value of "host" will instead share the network with the host, like it was in previous versions.

It's also possible to set the "network_mode" parameter within the task driver config. It simply overrides the global driver parameter and thus allows a different mode for specific containers.

Driver can attach a container to lxcbr0 now.
@hashicorp-cla
Copy link

hashicorp-cla commented Jun 28, 2019

CLA assistant check
All committers have signed the CLA.

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.

@towe75 I left some comments in your other PR about making the CLA bot happy.

For this PR:

  • Can we add documentation to the README for what requirements the bridge networking mode imposes on clients? It looks like this at least assumes that the lxcbr0 is already set up.
  • While other drivers have this same network_mode config, in Nomad 0.10 we have support for CNI plugins, including configuring network namespaces at the task group level (so we can share a network namespace even between different task drivers!). Do you think you'd be interested in trying to get the LXC driver to be able to support that networking mode as well?

@towe75
Copy link
Contributor Author

towe75 commented Nov 5, 2019

@tgross about lxcbr0: i'll add a section to the README, also a parameter for the bridge name might be a good idea.

Regarding CNI: i will make it configurable in my nomad-driver-podman soon. AFAIK LXC does not use CNI at all, although it's possible to share the network namespace with other containers and this plugin could expose this feature in a nomad group, if somebody needs it.

@tgross
Copy link
Member

tgross commented Nov 5, 2019

Sounds good on that, @towe75. Looks like there's a merge conflict now that the other PR has been merged.

@towe75 towe75 changed the title Attach lxc containers to lxcbr0 by configuring a new network_mode parameter [WIP] Attach lxc containers to lxcbr0 by configuring a new network_mode parameter Nov 10, 2019
@towe75
Copy link
Contributor Author

towe75 commented Nov 10, 2019

@tgross merge conflict is solved.
I changed the PR title to reflect that i want to give the code another iteration before merging. At least the bridge name should be configurable, a test would also be nice.

@dinesh
Copy link

dinesh commented Jul 8, 2020

@tgross can we merge this PR and have a release for lxc driver? I'm using lxc based containers and need non-host networking.

@towe75
Copy link
Contributor Author

towe75 commented Jul 8, 2020

@dinesh, @tgross sorry for not continuing here. I wanted to make the bridge name configurable but the PR can be useful even with hardcoded "lxcbr0" because it's the defacto default bridge name on debian'ish systems.

@tgross
Copy link
Member

tgross commented Jul 8, 2020

Ok, we're going to merge this as-is and cut a new tag for it.

@tgross tgross merged commit 031735d into hashicorp:master Jul 8, 2020
@tgross
Copy link
Member

tgross commented Jul 8, 2020

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.

4 participants