-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add podman network create flag for bridge mtu #8457
Add podman network create flag for bridge mtu #8457
Conversation
You need to update man pages |
Need tests, and I don't think this will work on podman-remote right now. |
cmd/podman/networks/create.go
Outdated
@@ -42,6 +42,8 @@ func networkCreateFlags(cmd *cobra.Command) { | |||
|
|||
flags.BoolVar(&networkCreateOptions.Internal, "internal", false, "restrict external access from this network") | |||
|
|||
flags.IntVar(&networkCreateOptions.MTU, "mtu", 0, "MTU") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do a more general options flag? It seems like there could be quite a lot of these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The Docker extremely-long-option format is probably unnecessary, but something like --bridge-option mtu=8000
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose there couldn't be many more than what the CNI "bridge" exposes, but hopefully the user (OP) has more input...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my use case I need only the MTU setting to sync it with an underlying network.
When looking at the bridge driver parameters, there's maybe one more good candidate for this - the vlan
tag parameter..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @mheon Lets do this as --bridge-option and just add the two for now, which leaves us room for more in the future without exploding out CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other commands use "opt" (instead of option), for instance the one from "podman volume create"
-o, --opt stringArray Set driver specific options (default [])
Like the ones from "run":
--dns-opt strings Set custom DNS options
--log-opt strings Logging driver options
--security-opt stringArray Security Options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
ffd4722
to
e9949fd
Compare
@@ -45,6 +45,10 @@ must be used with a *subnet* option. | |||
Create a *Macvlan* based connection rather than a classic bridge. You must pass an interface name from the host for the | |||
Macvlan connection. | |||
|
|||
#### **--mtu** | |||
|
|||
The MTU (integer, optional). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chunked this together form Wikipedia, is this correct or needs adjusting? I think we need a bit more info than what's here at the moment.
The MTU (integer, optional). | |
The Maximum Transmission Unit (MTU), the size of the largest protocol data unit that can be communicated in a single network-layer transaction (integer, optional). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully the middle road is OK, with the new options
e9949fd
to
3c836ec
Compare
I will need some help with this (integration test, and podman remote support) |
@afbjorklund When you get this to a state that you are happy with, we can get someone to take it over if you want. |
Set driver specific options. | ||
|
||
For the `bridge` driver the following options are supported: `mtu`. | ||
The `mtu` option sets the Maximum Transmission Unit (MTU) and takes an integer value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I think this should work, and the flag matches the "network" which also uses drivers.
And then we don't need another option, for the second driver ? Was there another flag that should be added as well ? I think "vlan" was mentioned https://www.cni.dev/plugins/main/bridge/
The remaining feature is --label, but as mentioned that needs some more work: Minikube is using labels, to identify which volumes and networks are OK to remove...
The workaround is for the user to clean them up manually... Volume does have --label, but the --filter was missing value. ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podman-remote
works since we are using the full NetworkCreateOptions
struct as json in the body.
For the integration tests I recommend adding this to test/e2e/network_create_test.go
:
It("podman network create with mtu option", func() {
net := "mtu-test"
nc := podmanTest.Podman([]string{"network", "create", "--opt", "mtu=9000", net})
nc.WaitWithDefaultTimeout()
Expect(nc.ExitCode()).To(BeZero())
defer podmanTest.removeCNINetwork(net)
nc = podmanTest.Podman([]string{"network", "inspect", net})
nc.WaitWithDefaultTimeout()
Expect(nc.ExitCode()).To(BeZero())
Expect(nc.OutputToString()).To(ContainSubstring(`"mtu": 9000,`))
})
3c836ec
to
e8eb15c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
For the `bridge` driver the following options are supported: `mtu` and `vlan`. | ||
The `mtu` option sets the Maximum Transmission Unit (MTU) and takes an integer value. | ||
The `vlan` option assign VLAN tag and enables vlan\_filtering. Defaults to none. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just triple checking, I think the '` is intentional and needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry which one ? The backslash ? Editor was complaining about the "naked" underscore, so I escaped it... Maybe needlessly so. Not sure if it was seen as "half an italic" or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, messed up the md prior. vlan\_filtering
is what I was asking about. Seems to resolve OK, I'm just not sure it's necessary.
LGTM |
may be need to rebase to 1 commit? |
@afbjorklund needs a rebase, and then we can get this in. |
Signed-off-by: Anders F Björklund <[email protected]>
Signed-off-by: Anders F Björklund <[email protected]>
Thanks Luap99 for doing the implementation Signed-off-by: Anders F Björklund <[email protected]>
Thanks Luap99 for the validation suggestion Signed-off-by: Anders F Björklund <[email protected]>
9bbc3e3
to
db70e91
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afbjorklund, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
See #8454