apis: derive routing tables from a range of 10^9 IDs #407
<span aria-hidden="true">✅</span> Deploy Preview for dranet canceled.
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 21d574cf4758dcf6d3c14e486be7e657063ddf5b |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/dranet/deploys/6ae49e541bd7438a7765cd1b |
Welcome @NopeCharon! <br><br>It looks like this is your first PR to <a href='https://github.com/kubernetes-sigs/dranet'>kubernetes-sigs/dranet</a> 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval. <br><br>You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation. <br><br>You can also check if kubernetes-sigs/dranet has its own contribution guidelines. <br><br>You may want to refer to our testing guide if you run into trouble with your tests not passing. <br><br>If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs! <br><br>Thank you, and welcome to Kubernetes. :smiley:
Hi @NopeCharon. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.
Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
<details>
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
</details>
// RouteTableRange is the number of routing table IDs, starting at
// RouteTableOffset, that DRANET derives from names (1 << 30 = 1,073,741,824).
// By the birthday paradox, for k = 16 devices in one pod (C(16,2) = 120 pairs),
// the collision probability is ~120 / 2^30 ≈ 1.1e-7, while every derived ID
// (RouteTableOffset + [0, 2^30)) still fits in a signed int32.
RouteTableRange = 1 << 30
/ok-to-test
@NopeCharon please amend the change suggested and we are good to go, just one commit please
Applied the suggestion as is and squashed it into the single commit, so RouteTableRange is now 1 << 30.
/ok-to-test
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/kubernetes-sigs/dranet/pull/407#issuecomment-6536632027" title="Approved">aojea</a>, <a href="https://github.com/kubernetes-sigs/dranet/pull/407#" title="Author self-approved">NopeCharon</a>
The full list of commands accepted by this bot can be found here.
The pull request process is described here
<details >
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
</details>
<!-- META={"approvers":[]} -->
aojea
NopeCharon
What type of PR is this?
/kind bug
What this PR does / why we need it:
TableIDForNamepicked a routing table withfnv32a(name) % 1000 + 1000. The VRF default table, the GCE per-NIC tables (from the MAC) and the Alibaba per-bond tables all come from it, so two devices of one pod can get the same table. The second route to the same destination then fails withEEXIST, which the driver ignores, and traffic from the second device leaves through the first one. Some real names always clash, e.g.eth0/eth13(1812) andvrf26/vrf39(1777).As suggested in the issue, this takes the hash modulo 2^30 (
RouteTableRange) instead of 1000. Derived tables stay aboveRouteTableOffset(so away from the reserved tables 0 and 253-255) and below 2^31, so they fit in aninton every platform and in the kernel's u32 table ID. For 16 devices in one pod the chance of a clash goes from about 11% to about 10^-7.The new
TestTableIDForNamechecks the range, determinism, and that interface names, bond names, VRF names and GCE-style MACs that one pod can use together get different tables. It fails with the old modulus.Which issue(s) this PR is related to:
Fixes #344
Special notes for your reviewer:
vrf.tableexplicitly are unaffected.eth0/eth13setup from the issue now gets tables 739692812 and 402149812,ip route get 8.8.8.8 from <addr>resolves through each NIC's own gateway, and a VRF created with a derived table (356731777) reports that table back.go test ./pkg/apis/... ./pkg/cloudprovider/...andgolangci-lintv2.9.0 on the changed packages pass.Does this PR introduce a user-facing change?
``
release-note
``Routing table IDs that DRANET derives from names (the default VRF table, and the GCE and Alibaba per-device tables) now come from the range 1000 to 1073742823 instead of 1000 to 1999, so two devices of one pod no longer share a table by accident.