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 setting bond MTU #25

Merged
merged 1 commit into from Jan 27, 2022
Merged

Allow setting bond MTU #25

merged 1 commit into from Jan 27, 2022

Conversation

mmirecki
Copy link
Contributor

Allow setting the bond MTU value.

@mmirecki
Copy link
Contributor Author

mmirecki commented Jan 3, 2022

@killianmuldoon @rkamudhan Could you please look at this one, thanks

README.md Outdated
@@ -50,6 +51,7 @@ Given the following network configuration:
"type": "bond",
"mode": "active-backup",
"miimon": "100",
"mtu": 1500,
Copy link
Collaborator

Choose a reason for hiding this comment

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

please fix the indentation here

bond/bond.go Outdated
@@ -42,6 +42,7 @@ type bondingConfig struct {
FailOverMac int `json:"failOverMac"`
Miimon string `json:"miimon"`
Links []map[string]interface{} `json:"links"`
MTU string `json:"mtu"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be int? in the doc you mark it as int

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

bond/bond.go Outdated
if err != nil {
return nil, fmt.Errorf("Failed to convert bondMiimon value (%+v) to an int, error: %+v", bondMiimon, err)
}
if len(bondMTU) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we also validate that the MTU number provided is valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added validation that the mtu is not higher than the mtu of the pf of any of the vf's used. The link mac is used to match the pf's vf to the slave used in the bond.
The original vf mtu's are not relevant, as adding a link to a bond will modify it's mtu to that of the bond.

bond/bond.go Outdated
if err != nil {
return nil, fmt.Errorf("Failed to convert bondMiimon value (%+v) to an int, error: %+v", bondMiimon, err)
}
if len(bondMTU) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we also want to validate that the VFs we are going to attach have the same/higher MTU before we do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The VF mtu's will be automatically changed to that of the bond.

README.md Outdated
@@ -31,6 +31,7 @@ The binary should be placed at /opt/cni/bin on all nodes on which bonding will t
- type (string, required): "bond"
- ifname (string, optional): name of the bond interface
- miimon (int, required): specifies the arp link monitoring frequency in milliseconds
- mtu (int, optional): the mtu of the bond

Choose a reason for hiding this comment

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

Suggested change
- mtu (int, optional): the mtu of the bond
- mtu (int, optional): the MTU of the bond. Default is 1500.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

This patch allows setting the MTU of the created bond.

Signed-off-by: <mmirecki@redhat.com>
if err != nil {
return fmt.Errorf("Failed to lookup physical functions links, error: %+v", err)
}
for _, pfLink := range pfLinks {
Copy link
Collaborator

Choose a reason for hiding this comment

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

how you are able to get the PF info? you are inside the pod namespace already no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that a cni does not work inside a namespace. You have to enter the namespace yourself.
One of the input parameters the CNI binary is getting is the CNI_NETS environment variable, which points us to the namespace for the container it is to connect.
We are getting the netlink handle for the pf without specifying the ns (here), so we operate with no namespace here.
The slaves are retrieved in getLinkObjectsFromConfig() which takes a handle created using a ns (here).

@SchSeba
Copy link
Collaborator

SchSeba commented Jan 25, 2022

/lgtm

@cgoncalves
Copy link

@Eoghan1232 @SchSeba thanks for the review and approval. Is there anything else missing or can this PR be merged?

@Eoghan1232
Copy link
Collaborator

PR approved by myself and @SchSeba.
Proceeding with Merge.

@Eoghan1232 Eoghan1232 merged commit 5d09199 into k8snetworkplumbingwg:master Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants