Skip to content

Conversation

@QxBytes
Copy link
Contributor

@QxBytes QxBytes commented Jul 18, 2022

Reason for Change:

Creates a linux native endpoint client which is meant to replace the existing endpoint client that uses OVS. Uses the native linux kernel to replicate the functionality of OVS. Using the native client should improve the reliability of the multitenancy datapath because there will no longer be a dependency on OVS.

Issue Fixed:

Requirements:

Notes:
Creates a new netns package and uses vishvananda's netns and netlink library.

@QxBytes QxBytes requested review from matmerr and rbtr as code owners July 18, 2022 18:18
Copy link
Collaborator

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

some initial comments - several things which apply globally, and I expect fixes to be applied to the whole PR even though I have only commented on a single instance.
pls also address the feedback from the linter

Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

Thanks for this PR.. Left some comments

rbtr
rbtr previously approved these changes Jul 27, 2022
Copy link
Collaborator

@rbtr rbtr left a comment

Choose a reason for hiding this comment

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

some nitpicks but generally lgtm

Comment on lines 324 to 328
if err := client.netlink.AddOrRemoveStaticArp(netlink.ADD,
interfaceName,
virtualGwNet.IP,
hardwareAddr,
false); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

unwrap
splitting method signatures or invocations across lines is worse for readability

Comment on lines 125 to 118
} else {
// Any other error
return errors.Wrap(deleteNSIfNotNilErr, "failed to create vlan vnet link after making new ns")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think you could flip this conditional to eliminate the else branch entirely

}
type NativeEndpointClient struct {
eth0VethName string // So like eth0
vlanVethName string // So like eth0.1
Copy link
Member

Choose a reason for hiding this comment

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

this can be vlanEthName

}
defer ns.Close()
// Enter the network namespace
log.Printf("[ExecuteInNS] Entering vnetns %s.", ns.file.Name())
Copy link
Member

Choose a reason for hiding this comment

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

log looks confusing. why vnetns? i guess this is generic function


// Exit network namespace
defer func() {
log.Printf("[ExecuteInNS] Exiting vnetns %s.", ns.file.Name())
Copy link
Member

Choose a reason for hiding this comment

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

same here

})
}

func (client *NativeEndpointClient) DeleteEndpointsImpl(ep *endpoint, routesLeft int) error {
Copy link
Member

Choose a reason for hiding this comment

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

wanted to understand on routesLeft logic.. lets talk offline about this

@tamilmani1989 tamilmani1989 added cni Related to CNI. feature labels Aug 1, 2022
DeleteNamed(name string) (err error)
}
type NativeEndpointClient struct {
eth0VethName string // So like eth0
Copy link
Member

@tamilmani1989 tamilmani1989 Aug 1, 2022

Choose a reason for hiding this comment

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

this is not veth..rename as "primaryHostIfName"

Copy link
Member

@tamilmani1989 tamilmani1989 left a comment

Choose a reason for hiding this comment

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

lgtm

QxBytes added 26 commits August 1, 2022 15:00
Directly instantiating struct because nothing special happens in NewNativeEndpointClient
Forgot to remove uintptr from mocknetns
Works on VMSS
If I use GetNetworkInterface, I need to be in the vnet NS, but that means I will need to call ExecuteInNS, which causes tests to fail.
Hopefully this fixes the windows lint error
Maybe this will fix the windows linter?
Maybe this fixes the linter error?
Tests ok, ping ok, wget ok
@rbtr rbtr force-pushed the t-allew/develop branch from 1807094 to 64794e6 Compare August 1, 2022 22:00
@rbtr
Copy link
Collaborator

rbtr commented Aug 1, 2022

rebased for CI fixes; lgtm

@tamilmani1989 tamilmani1989 merged commit d57e24e into Azure:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cni Related to CNI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants