whereabouts
whereabouts copied to clipboard
Add support for dualstack / multiple IP ranges
New Feature
Motivation
This PR adds support for IPv4/IPv6 dual-stack and multiple IP assignment
Feature proposal: #237
Changes
- Introduced a new type
RangeConfigurationinpkg/types/types.gofor encapsulating configurations of range for IP assignment - Add new field
IPRanges []RangeConfigurationinIPAMConfigfor handling multiple IP ranges - Update
config.goto work withIPRangesinstead ofIPAM.Range, ... - Use
RangeConfigurationinallocate.AssignIPinstead ofIPAMConfig - Integrate
IPRangeswith etcd's IP Management - Integrate
IPRangeswith kubernetes' IP Management - Update whereabouts' logic to assign multiple new IPs to a pod based on a list of new IPs returned by IP Management module
- Update function definition of
garbageCollectorto match with the changes in definition ofwbclient.IPManagement
Tasks
Project management
- [x] Created a related issue
- [x] Added proper labels to the issue @dougbtv
- [x] Assigned yourself as the assignee @dougbtv
- [x] Created a PR for design proposal
- [x] Finalized and merged design proposal @dougbtv @maiqueb
Code management
- [x] Update IPAM structure
- [x] Backward compatibility
- [x] Add feature to support dual-stack
- [x] Add feature to support multiple IP ranges
- [x] Manual testing for above feature
- [x] Update old test cases
- [x] Add new test cases for the added features
- [x] Update documentation
- [x] Checked for mistakenly committed files
Closes #212
Test for multiple IP assignment
NAD
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: whereabouts-conf
spec:
config: '{
"cniVersion": "0.3.0",
"name": "whereaboutsexample",
"type": "macvlan",
"master": "eth0",
"mode": "bridge",
"ipam": {
"type": "whereabouts",
"ipRanges": [{
"range": "10.10.10.10/24",
"range_start": "10.10.10.20",
"range_end": "10.10.10.200"
}, {
"range": "11.11.11.11/24",
"range_start": "11.11.11.20",
"range_end": "11.11.11.200"
}]
}
}'
Pod IP Config
5: net1@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether aa:ac:37:3a:1a:91 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.10.10.20/24 brd 10.10.10.255 scope global net1
valid_lft forever preferred_lft forever
inet 11.11.11.20/24 brd 11.11.11.255 scope global net1
valid_lft forever preferred_lft forever
inet6 fe80::a8ac:37ff:fe3a:1a91/64 scope link
valid_lft forever preferred_lft forever
Test for IPv4/IPv6 dual-stack
NAD
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: whereabouts-conf
spec:
config: '{
"cniVersion": "0.3.0",
"name": "whereaboutsexample",
"type": "macvlan",
"master": "eth0",
"mode": "bridge",
"ipam": {
"type": "whereabouts",
"ipRanges": [{
"range": "10.10.10.10/24",
"range_start": "10.10.10.20",
"range_end": "10.10.10.200"
}, {
"range": "2001::1/64",
"range_start": "2001::16",
"range_end": "2001::64"
}]
}
}'
Pod IP Config
5: net1@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether ee:f1:0a:a4:f3:cd brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.10.10.20/24 brd 10.10.10.255 scope global net1
valid_lft forever preferred_lft forever
inet6 2001::16/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::ecf1:aff:fea4:f3cd/64 scope link
valid_lft forever preferred_lft forever
@Ayush21298 Hi, is there any plan to support dual stack in the recent release?
@Ayush21298 Hi, is there any plan to support dual stack in the recent release?
@hhhybb Hi, I'll require some time to proceed with fixing some minor issues, adding backward compatibility and testing. If backward compatibility is not a major requirement, you can use this branch for basic DualStack functionality :)
@Ayush21298 Hi, is there any plan to support dual stack in the recent release?
@hhhybb Hi, I'll require some time to proceed with fixing some minor issues, adding backward compatibility and testing. If backward compatibility is not a major requirement, you can use this branch for basic DualStack functionality :)
@Ayush21298 Thanks for your reply, I have installed the old versions in the production environment and need backward compatibility when upgrading. I am looking forward to it can be merged into master. Thanks for your efforts.
Pull Request Test Coverage Report for Build 3385784200
- 70 of 86 (81.4%) changed or added relevant lines in 5 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.5%) to 70.19%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| pkg/allocate/allocate.go | 0 | 1 | 0.0% |
| pkg/controlloop/dummy_controller.go | 2 | 3 | 66.67% |
| pkg/config/config.go | 35 | 41 | 85.37% |
| pkg/controlloop/pod.go | 20 | 28 | 71.43% |
| <!-- | Total: | 70 | 86 |
| Totals | |
|---|---|
| Change from base Build 3250004817: | 0.5% |
| Covered Lines: | 923 |
| Relevant Lines: | 1315 |
💛 - Coveralls
Test for IPv4/IPv6 dual-stack along with Old Range configuration
NAD
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: whereabouts-conf
spec:
config: '{
"cniVersion": "0.3.0",
"name": "whereaboutsexample",
"type": "macvlan",
"master": "eth0",
"mode": "bridge",
"ipam": {
"type": "whereabouts",
"range": "12.12.12.12/24",
"ipRanges": [{
"range": "10.10.10.10/24",
"range_start": "10.10.10.20",
"range_end": "10.10.10.200"
}, {
"range": "2001::1/64",
"range_start": "2001::16",
"range_end": "2001::64"
}]
}
}'
Pod IP Config
5: net1@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 8e:58:0a:33:88:10 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 10.10.10.20/24 brd 10.10.10.255 scope global net1
valid_lft forever preferred_lft forever
inet 12.12.12.1/24 brd 12.12.12.255 scope global net1
valid_lft forever preferred_lft forever
inet6 2001::16/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::8c58:aff:fe33:8810/64 scope link
valid_lft forever preferred_lft forever
Test for IPv4/IPv6 dual-stack along with Old Range configuration
NAD
apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: whereabouts-conf spec: config: '{ "cniVersion": "0.3.0", "name": "whereaboutsexample", "type": "macvlan", "master": "eth0", "mode": "bridge", "ipam": { "type": "whereabouts", "range": "12.12.12.12/24", "ipRanges": [{ "range": "10.10.10.10/24", "range_start": "10.10.10.20", "range_end": "10.10.10.200" }, { "range": "2001::1/64", "range_start": "2001::16", "range_end": "2001::64" }] } }'Pod IP Config
5: net1@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default link/ether 8e:58:0a:33:88:10 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 10.10.10.20/24 brd 10.10.10.255 scope global net1 valid_lft forever preferred_lft forever inet 12.12.12.1/24 brd 12.12.12.255 scope global net1 valid_lft forever preferred_lft forever inet6 2001::16/64 scope global valid_lft forever preferred_lft forever inet6 fe80::8c58:aff:fe33:8810/64 scope link valid_lft forever preferred_lft forever
Cool. Please add an e2e test with this behavior, by introducing a new context in here.
Cool. Please add an e2e test with this behavior, by introducing a new context in here.
Sure :) I wanted to do that before the meeting, but got a bit delayed :sweat_smile:
Cool. Please add an e2e test with this behavior, by introducing a new context in here.
@maiqueb I have added both e2e test cases as well as unit tests for whereabouts' module :) Please review them when you are available ^^
@dougbtv Hi, I would like to start using multiple IP ranges right now, judging by the comments there is already a working version of this feature https://github.com/k8snetworkplumbingwg/whereabouts/pull/60 Can someone confirm that this PR is already in use by someone and is it stable?
And also if I now use https://github.com/k8snetworkplumbingwg/whereabouts/pull/60 Will it be possible to migrate to https://github.com/k8snetworkplumbingwg/whereabouts/pull/250 are they compatible ?
#225 is merged @Ayush21298 we're good for a rebase, thanks!
@kmlebedev -- #60 was rejected (my apologies to the contributor) so there's no guarantee of compatibility, my apologies but it was never in master. So you might need to figure out your own migration path.
#225 is merged @Ayush21298 we're good for a rebase, thanks!
@dougbtv Thanks for letting me know. I'll notify you after rebasing :)
@dougbtv @maiqueb I have rebased the code :) Can you please have a look ?
@maiqueb Thank you so much for your review :)
I intended to rewrite the history properly once I got review for the overall structure of the code, since the changes were made iteratively due to some other PRs which had major changes in the code-base.
Thank you so much for putting an effort to review the PR commit-wise irrespective of the presence of hindrances like conflict resolution commits etc.
I'll update the code-base to address your review comments and then rewrite the history so that the updates can be included/excluded in the proper commits where they should be placed :)
@maiqueb Thank you so much for your review :)
I intended to rewrite the history properly once I got review for the overall structure of the code, since the changes were made iteratively due to some other PRs which had major changes in the code-base.
Thank you so much for putting an effort to review the PR commit-wise irrespective of the presence of hindrances like conflict resolution commits etc.
I'll update the code-base to address your review comments and then rewrite the history so that the updates can be included/excluded in the proper commits where they should be placed :)
Perfect! Just let me know when this becomes ready to be looked at.
Perfect! Just let me know when this becomes ready to be looked at.
Sure. Thanks you so much again for your review :)
Oh I can't request review from both @dougbtv and @maiqueb at the same time :thinking:
@maiqueb I have squashed the code, re-based and rewritten the commit history :)
Most of your comments were addressed by this and for rest of them I did the appropriate changes in the code.
Please review it when you are available :)
Secondly, if you want, we can squash the commits more, but that will make the commit a bit complex for reviewing. Let me know if you want me to do that. Thanks :)
@maiqueb I have added a separate new commit with the changes for addressing the review comment for the ease in review. Once I get a green light from you, I'll add the respective sections in appropriate commits. Thanks :)
@maiqueb Thanks for your opinions :) I have removed the "old range" completely as we discussed in the meeting, addressed all your comments and added the related fixes in their respective commits. Please review it when you are available :)
@maiqueb Thanks for your review again :) Updated the code in respective commits to address the comments ^^
which release dual stack feature is available.
which release dual stack feature is available.
Hopefully from the next release :)
@dougbtv and @maiqueb can tell better ^^