-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add dual-stack support in host-local IPAM + Canal #5313
Add dual-stack support in host-local IPAM + Canal #5313
Conversation
/sem-approve |
This looks lovely, thank you @manuelbuil! Fixes #5188 |
Looks like a static check failure:
|
fa93352
to
33c396e
Compare
Thanks, I see why |
Is it normal for the CI to take more than 5 hours to report the result? |
/sem-approve |
CI only runs once a team member approves the PR to run. |
Ah! Thanks for the info |
I need some help to fix the unit tests because I don't know what is going on :(. 5 tests are failing with:
The 6th test that fails is the one I added. It fails because there is no dual-stack k8s cluster and thus there is no ipv6 cidr to replace |
After spending some hours digging the first error, I still did not find what is going on. I found that the error appears here:
And the error is pluginPath is
args is:
I added a log in |
@manuelbuil I'll take a look and let you know what I find! |
@@ -721,6 +721,52 @@ var _ = Describe("Kubernetes CNI tests", func() { | |||
numIPv4IPs: 1, | |||
numIPv6IPs: 1, | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scenario is failing because the node created as part of this set of tests doesn't have dual-stack CIDRs present: https://github.com/projectcalico/calico/blob/master/cni-plugin/tests/calico_cni_k8s_test.go#L859-L865
We probably want a new section for dual-stack tests so that we don't reduce coverage for the legacy / single-stack case. i.e., we want tests for both PodCIDR
and PodCIDRs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried something :)
@manuelbuil I think I figured out what is going on - stuck some comments on the PR in the relevant places. Let me know if you have any questions! |
a4c3cb0
to
2d96056
Compare
/sem-approve |
Tests are finally running locally but in CI it fails with:
Any idea? Maybe I should change the range in the second set of tests? Let me try that |
2d96056
to
b5b491b
Compare
/sem-approve |
It did not help. Same error again:
Any idea? Thanks! |
@manuelbuil I'll take a look a this today - sorry for the delay, have been on vacation! Happy new year :) |
@manuelbuil I think this might be a result of a flake in the gRPC test that is failing that has been fixed in master - could you try rebasing this PR against master and we'll see if the test passes? |
No worries, I was on vacation as well :). Happy new year to you too! |
b5b491b
to
44cd28c
Compare
/sem-approve |
Signed-off-by: Manuel Buil <[email protected]>
44cd28c
to
32d008e
Compare
/sem-approve |
Looks like the tests are happy now, hooray! |
Signed-off-by: Manuel Buil [email protected]
Description
This PR provides dual-stack support for canal. It requires three changes in the canal config/manifest:
Change 1
The ipam section of the cni_network_config for dual-stack must be defined like this:
The effective changes are:
a) the
"subnet": "usePodCidr"
moves inside the ranges sliceb) we define a new subnet called
usePodCidrIPv6
This PR does not break the current way of deploying canal for ipv4 single-stack. If you want dual-stack, you'll need to apply this config change. If not, you are fine with the current config.
Change 2
The flannel image of the
kube-flannel
container, must move to, at least, version 0.15 which support dual-stack. For example:image: quay.io/coreos/flannel:v0.15.1
Change 3
We must activate the dual-stack feature in flannel. To do so, in the flannel
net-conf.json
, we must add the following fields:The IPv6Network can be anything. We will anyway read the CIDR assigned to the node
In the code, the essential change is that we are now asking for
node.Spec.PodCIDRs
instead ofnode.Spec.PodCIDR
. As a consequence, we will receive a slice of strings, which will have length=1 in the single-stack case and length=2 in the dual-stack case. There is a new functiongetIPsByFamily
that reads the podCidrs and returns the ipv4 and the ipv6 cidr. The former substitutes"subnet": "usePodCidr"
in the host-local ipam config. The latter substitutes"subnet": "usePodCidrIPv6"
in the host-local ipam config.Moreover, we use a dummy ipv4 and ipv6 address to release the host-local IP and a test is included with
usePodCidrIPv6
I did not change anything in
UpdateHostLocalIPAMDataForWindows
because dual-stack is not supported in k8s for vxlan scenarios in Windows: https://kubernetes.io/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#ipv6-networking (added a comment about this)Related issues/PRs
Todos
Release Note