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

Sort the endpoints such that eth0 is first #2231

Merged

Conversation

katiewasnothere
Copy link
Contributor

This addresses an issue where when adding multiple interfaces, the eth0 interface in the guest does not correspond correctly to the primary NIC that the CNI intended. This happens because hcsshim queries HNS to get the list of endpoints for the network namespace and adds the endpoints sequentially based on what is returned from HNS. HNS guarantees no specific ordering of endpoints returned from this query.

CNI names the interfaces such that they have the suffix -ethX where X is the index for the interface. We could leverage this information in the future to sort all the endpoints according to index. However, I didn't think that was necessary here since we are only working with two endpoints added to the UVM and the CNI team confirmed they do not care about the ordering of the non-eth0 endpoints for now. We are working on a better long-term solution for that scenario.

Without this change, if an endpoint is incorrectly added first as the eth0 when it should not be, the pod may not be able to communicate with other pods as expected since the eth0 interfaces on other pods may be using endpoints from different subnets.

@katiewasnothere katiewasnothere requested a review from a team as a code owner August 12, 2024 21:40
internal/uvm/network.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ambarve ambarve left a comment

Choose a reason for hiding this comment

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

Two minor comments, but otherwise LGTM!

Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
@katiewasnothere katiewasnothere merged commit ba6e8ea into microsoft:main Aug 14, 2024
18 of 19 checks passed
@katiewasnothere katiewasnothere deleted the kabaldau/sort_endpoints branch August 14, 2024 21:31
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.

3 participants