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

Support more than one IP per interface and IPv6 for results returned by CNI #478

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

th0m
Copy link

@th0m th0m commented Jan 28, 2023

Our use case is to:

  1. call SetupNetworkHandler ourselves to get the network configuration generated using a CNI plugin
  2. remove firecracker.SetupNetworkHandlerName and firecracker.SetupKernelArgsHandlerName from the list of default FcInit handlers
  3. use our own VM network interface configuration method instead of the default boot param based one
  4. call machine.Start

With that in mind we want to be able to have more than one IP on interfaces and to support IPv6, which is what this change intends on achieving while keeping backwards compatibility.

@th0m th0m requested a review from a team as a code owner January 28, 2023 00:43
@th0m
Copy link
Author

th0m commented Feb 28, 2023

@vvejell1 can you please help review this PR when you have a moment? Thank you.

@ginglis13
Copy link
Contributor

Hi @th0m , looks like buildkite tests (example) have not run:

Missing DCO on d88daf3

could you please sign your commit ? if you've already got your name and email configured in git, you can git commit --amend -s, then force push to this branch to update the PR

@th0m
Copy link
Author

th0m commented Mar 6, 2023

@th0m
Copy link
Author

th0m commented Mar 15, 2023

@ginglis13 can you please have a look? Thanks

@ginglis13
Copy link
Contributor

@th0m we've got an infrastructure bug we're addressing. As soon as it's resolved we can re-run and continue the review

@fangn2
Copy link
Contributor

fangn2 commented Mar 24, 2023

@th0m I have a fix on CI failure merged into main. You can rebase, push and trigger the build again.

@th0m
Copy link
Author

th0m commented Mar 24, 2023

Thanks, build failures are on me now, I will fix them.

@th0m th0m force-pushed the tlefebvre/upstream branch 2 times, most recently from 964e4f4 to e0b0c97 Compare March 24, 2023 22:58
@th0m
Copy link
Author

th0m commented Mar 24, 2023

Ready for review @fangn2 thank you.

network_test.go Outdated
err := staticNetworkConfig.validate()
assert.Error(t, err, "invalid network config hostdevname did not result in validation error")
}
// TestNetworkStaticValidationFails_IPConfiguration removed as IPv6 support was added in this fork
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could you add a note about this to the commit message and/or PR body? not sure we need the comment to remain

Copy link
Author

Choose a reason for hiding this comment

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

Absolutely, I have just pushed the change.

…by CNI

Note that the TestNetworkStaticValidationFails_IPConfiguration test was removed
since IPv6 support got added.

Signed-off-by: Thomas Lefebvre <tlefebvre@cloudflare.com>
@th0m
Copy link
Author

th0m commented Apr 10, 2023

@ginglis13 I believe this is ready to go.

// the first two in the slice will be applied in the VM.
// - VMDomain, VMSearchDomains and VMResolverOptions will be ignored
// - Nameserver settings are also only set in /proc/net/pnp. Most applications will thus require
// /etc/resolv.conf to be a symlink to /proc/net/pnp in order to resolve names as expected.
func (c StaticNetworkConf) IPBootParam() string {
// See "ip=" section of kernel linked above for details on each field listed below.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a check here to validate VMIPConfig has only 1 IP here, else error out?

for _, ip := range []net.IP{ipConf.IPAddr.IP, ipConf.Gateway} {
if ip.To4() == nil {
return fmt.Errorf("invalid ip, only ipv4 addresses are supported: %+v", ip)
if ip.To4() == nil && ip.To16() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test for this change in network_test.go?

IPAddr: net.IPNet{
IP: net.ParseIP("2001:db8:a0b:12f0::2"),
Mask: net.CIDRMask(24, 128),
invalidIPConfiguration = []*IPConfiguration{
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any tests using this invalid config. Can we add one and also validate IPv6 support?

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