-
Notifications
You must be signed in to change notification settings - Fork 939
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
Added support for additional lxc.network settings #741
Conversation
Signed-off-by: Kerry Schwab <[email protected]>
Hi, So actually those options were intentionally left out from LXD. The main reason for this decision is that almost all workloads will unset any pre-configured network configuration. So instead of pre-configuring the network namespace, LXD just lets the client do DHCP or alternatively provides configuration through userdata exposed to the container (and through the upcoming /dev/lxd device). As for the up/down scripts, they are a bit of a nightmare when you have to support live migration as if they are inside the container, they are a security risk (as they run partly in the host namespace) and if they are outside the container, then they're not migrated, making the container configuration invalid. The current LXD design is to never execute untrusted code outside of a trusted environment, which is why our image format supports templating, but not hooks and why we haven't implemented hook scripts anywhere else. We also find executing scripts to be generally brittle and hard to extend without breaking existing users. There's however a plan that moving forward we'll support global hooks with a hook API so that those hooks can talk cross-server during live migration. Designing this is rather tricky and so far hasn't really been a priority. With all that, I unfortunately have to decline this, otherwise perfectly good pull request. If you have very specific use cases that aren't covered with current LXD, please let us know and we'll check how that fits with our planned work and whether there's something we missed. Thanks! |
Sure. The specific use case is a traditional VPS, with public facing IP addresses. The supplied dnsmasq and veth setup works terrific with nat ips, but doesn't work well with real, routable ipv4s. But, in this case, we can likely manage in a different way. I'll see if there's some way we can use DHCP. It's a bit tricky in that the servers are ours, but the network is not. Thank you. |
Right, so in your case you can usually go one of two ways:
|
Yes, thanks. It's the assigning an ip part that's a little tricky. We do have the WAN interface bridged, and are using these additional options to set the ip, default gateway, etc, for the containers. DHCP isn't ideal, as the packets leak onto a network that isn't ours, with DHCP servers on it. We can, of course, alter the files in the container to set the ip address there, but then we lose the "remote control" benefit of lxd. The idea was to leverage the lxd remote api...allowing us a simple, central web-based panel for customers to spin up a VPS on any of the available servers. Something like the way Wable works. We give them not a specific VPS, but a pool of a specific number of ips, memory, and storage. They can make one big VPS, with all the ips/memory/storage, or several small ones, etc. But then, that's not really your issue :) We'll either have to keep our local mods, or take an entirely different approach than lxd. I can say that I like the lxd approach. The code is very easy to follow. |
Part of canonical#741 Signed-off-by: Vishesh Agrawal <[email protected]> (cherry picked from commit 7c84b4b60b864f722ac373db9f1ad3280edb9bd2) Signed-off-by: Gabriel Mougard <[email protected]> License: Apache-2.0
Part of canonical#741 Signed-off-by: Vishesh Agrawal <[email protected]> (cherry picked from commit 7c84b4b60b864f722ac373db9f1ad3280edb9bd2) Signed-off-by: Gabriel Mougard <[email protected]> License: Apache-2.0
Part of canonical#741 Signed-off-by: Vishesh Agrawal <[email protected]> (cherry picked from commit 7c84b4b60b864f722ac373db9f1ad3280edb9bd2) Signed-off-by: Gabriel Mougard <[email protected]> License: Apache-2.0
Part of canonical#741 Signed-off-by: Vishesh Agrawal <[email protected]> (cherry picked from commit 7c84b4b60b864f722ac373db9f1ad3280edb9bd2) Signed-off-by: Gabriel Mougard <[email protected]> License: Apache-2.0
Signed-off-by: Kerry Schwab [email protected]