Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Set veth MTU using CALICO_LIBNETWORK_VETH_MTU#164

Merged
robbrockbank merged 1 commit intoprojectcalico:masterfrom
ti-mo:master
Nov 27, 2017
Merged

Set veth MTU using CALICO_LIBNETWORK_VETH_MTU#164
robbrockbank merged 1 commit intoprojectcalico:masterfrom
ti-mo:master

Conversation

@ti-mo
Copy link
Copy Markdown
Contributor

@ti-mo ti-mo commented Nov 17, 2017

Description

Ref. https://github.com/projectcalico/calicoctl/issues/488

I've introduced an environment variable CALICO_LIBNETWORK_VETH_MTU to set the MTU of the veth pairs created by the Calico libnetwork plugin. As discussed in the issue above, this allows FELIX_IPINIPMTU to be controlled separately from the veth MTU.

Worth noting is that this extends the signature of netns.CreateVeth, and I'm not sure if there are any other packages that use this function.

This was tested manually, could not get the tests on master to run. I'll need some help/pointers on how to add this to the test suite.

Will this ever make it into 2.6, or should I add this to the 3.0 docs?

Todos

  • Tests
  • Documentation
  • Release note

Release Note

MTU of veth endpoints created by calico-libnetwork can now be configured using `CALICO_LIBNETWORK_VETH_MTU`.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 17, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@caseydavenport caseydavenport left a comment

Choose a reason for hiding this comment

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

Just one minor comment from me - looks good!

I think your tests are failing due to a known issue: #162

Would appreciate a secondary review from @fasaxc or @robbrockbank since I'm not super familiar with this code.

Thanks!

Comment thread driver/network_driver.go Outdated

driver.vethMTU = uint16(mtu)

log.Info("calico-net veth MTU set to ", mtu)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: we generally prefer logs which use WithField (though I know a lot of the logs in this file don't use that approach!)

e.g.

log.WithField("mtu", mtu).Info("Parsed veth MTU")

@caseydavenport
Copy link
Copy Markdown
Member

Just merged #163 which should fix your CI errors if you rebase.

@ti-mo
Copy link
Copy Markdown
Contributor Author

ti-mo commented Nov 22, 2017

@caseydavenport Thanks, tests are passing now, just need a review.

To repeat my original question: is this going to be backported to 2.6 or will it land in 3.0? Where should this be documented?

Comment thread driver/network_driver.go Outdated
ifPrefix: IFPrefix,
DummyIPV4Nexthop: "169.254.1.1",

vethMTU: 1500,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ti-mo would it be safer to have the default as 0 (i.e. the current behaviour) instead of 1500? Unless we're sure that the kernel's default in all circumstances is 1500 then changing this default might break systems that rely on the kernel's behaviour. WDYT?

Copy link
Copy Markdown
Contributor Author

@ti-mo ti-mo Nov 22, 2017

Choose a reason for hiding this comment

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

Crap, I was worried about this. I couldn't find the default anywhere, but it happened to default to 1500 on the interface types (veth) we create. This will definitely not the case for overlay interface types.

There does not seem to be a canonical default defined per interface type in the netlink package either, so, logically, this is up to the kernel to infer when it receives a zero MTU value in a netlink message. I'll just remove this so vethMTU is always 0 unless overridden.

(Since this code only ever creates veths, I don't see this having any impact)

Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, lets have it default to "what we do now", or to a smaller value: with IPIP enabled, it should probably be 1460 to allow for the IPIP header.

@caseydavenport caseydavenport added this to the Calico v2.6.x milestone Nov 22, 2017
@caseydavenport
Copy link
Copy Markdown
Member

To repeat my original question: is this going to be backported to 2.6 or will it land in 3.0? Where should this be documented?

Sorry for missing that - I think we should get this into a v2.6 patch release. However, this will also make it into v3.1, so we'll want docs in both places.

@caseydavenport
Copy link
Copy Markdown
Member

@ti-mo if you could squash your commits, I'd be happy to merge (provided @fasaxc has no more feedback)

@ti-mo
Copy link
Copy Markdown
Contributor Author

ti-mo commented Nov 23, 2017

@caseydavenport Done, working on the documentation!

@robbrockbank robbrockbank merged commit 943866e into projectcalico:master Nov 27, 2017
@bcreane bcreane modified the milestones: Calico v2.6.x, Calico v2.6.4 Dec 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants