-
Notifications
You must be signed in to change notification settings - Fork 791
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
macvlan: set mac address from args #480
Conversation
@clinta looks mostly good, but can you update the testcases too with a case to set the MAC on creation? |
A test has been added to test setting the mac address. |
Sorry for the run-around, but I'm going to ask for one more small change :-). Then we can get this merged. Can you add support for the mac capability arg? See https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md#well-known-capabilities Thanks! |
I can do that. I'll look at the tuning plugin some more to see how it's done. I'm a bit new to CNI and added this for my own needs using podman, and I don't quite understand how the mac address in the network config is useful. Doesn't that result in every container on a network getting the same mac address? |
@clinta thanks! Let me know if you have any questions. CNI has 3 kinds of dynamic configuration: args, CNI_ARGS, and capability arguments. The latter is newest, and allows for a sort of negotiation between the runtime and the plugins around optional parameters. It's more structured CNI_ARGS, but provides essentially the same functionality. You don't write the mac parameter to the CNI configuration file. Rather, you tell the runtime (and libcni) where to substitute in the mac address at runtime. Make sense? |
This change sets the mac address if specified during the creation of the macvlan interface. This is superior to setting it via the tuning plugin because this ensures the mac address is set before an IP is set, allowing a container to get a reserved IP address from DHCP. Related containernetworking#450 Signed-off-by: Clint Armstrong <[email protected]>
Thanks, that cleared it up. I wasn't seeing at first how RuntimeConfig was set by the container runtime. I've added this functionality, and another test for it. |
Looks great, thanks! |
Now, do you want to add this parameter to the bridge and p2p plugins :-) ? |
This change sets the mac address if specified during the creation of the
macvlan interface. This is superior to setting it via the tuning plugin
because this ensures the mac address is set before an IP is set,
allowing a container to get a reserved IP address from DHCP.
Related #450