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

feature: enable ipv6 networking #2417

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

houstar
Copy link
Contributor

@houstar houstar commented Nov 3, 2018

Ⅰ. Describe what this PR did

  • add ipv6 and fixed-cidr-v6 into BridgeConfig
  • add ipv6 and fixed-cidr-v6 into DaemonConfig
  • add IPv6 network create inside BridgeMode

Ⅱ. Does this pull request fix one issue?

fixes #2415

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

These two commits already included the integration test cases

Ⅳ. Describe how to verify it

  1. [root@qing-for-dev$ ]pouchd --ipv6 true --debug
  2. Create container
[root@qing-for-dev$ ]pouch run -it gentoo/stage3-x86 bash
6cddc3c089e0 / # ip -6 a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
109: eth0@if110: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
    inet6 2002:db8:1::2/64 scope global nodad
       valid_lft forever preferred_lft forever
    inet6 fe80::42:c0ff:fea8:502/64 scope link dadfailed tentative
       valid_lft forever preferred_lft forever
6cddc3c089e0 / # ip -6 r s
2002:db8:1::/64 dev eth0 proto kernel metric 256
fe80::/64 dev eth0 proto kernel metric 256
default via 2002:db8:1::1 dev eth0 metric 1024
6cddc3c089e0 / # ping 2002:db8:1::1
PING 2002:db8:1::1(2002:db8:1::1) 56 data bytes
64 bytes from 2002:db8:1::1: icmp_seq=1 ttl=64 time=0.111 ms
64 bytes from 2002:db8:1::1: icmp_seq=2 ttl=64 time=0.058 ms
^C
--- 2002:db8:1::1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.058/0.084/0.111/0.028 ms

Ⅴ. Special notes for reviews

There is issue with vendor package `github.com/docker/libnetwork' when assign IPv6 address:

failed to create endpoint: invalid bit range [0, 18446744073709551615]

@codecov
Copy link

codecov bot commented Nov 3, 2018

Codecov Report

Merging #2417 into master will decrease coverage by 0.18%.
The diff coverage is 44.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2417      +/-   ##
==========================================
- Coverage   68.97%   68.79%   -0.19%     
==========================================
  Files         277      277              
  Lines       18298    18330      +32     
==========================================
- Hits        12621    12610      -11     
- Misses       4253     4281      +28     
- Partials     1424     1439      +15
Flag Coverage Δ
#criv1alpha1test 31.55% <44.06%> (-0.06%) ⬇️
#criv1alpha2test 35.65% <44.06%> (+0.06%) ⬆️
#integrationtest 40.4% <44.06%> (ø) ⬆️
#nodee2etest 32.78% <44.06%> (-0.28%) ⬇️
#unittest 26.69% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
network/mode/bridge/bridge.go 44.44% <44.06%> (-7.35%) ⬇️
cri/ocicni/cni_manager.go 58.82% <0%> (-11.77%) ⬇️
cri/v1alpha2/cri.go 69.02% <0%> (-1.27%) ⬇️
cri/v1alpha2/cri_wrapper.go 62.4% <0%> (-1.21%) ⬇️
ctrd/container.go 58.1% <0%> (-0.8%) ⬇️
daemon/mgr/container.go 58.36% <0%> (-0.44%) ⬇️
daemon/mgr/network.go 72.96% <0%> (+0.47%) ⬆️
daemon/logger/jsonfile/utils.go 73.17% <0%> (+1.62%) ⬆️
pkg/streams/utils.go 89.28% <0%> (+7.14%) ⬆️

@allencloud
Copy link
Collaborator

Is it OK to add some test of this? @houstar
I think test case could cover the features you added mostly. WDYT?

@houstar
Copy link
Contributor Author

houstar commented Nov 5, 2018

@allencloud OK. I"m working in progress with ipv6 testcases.

@houstar
Copy link
Contributor Author

houstar commented Nov 5, 2018

@allencloud @rudyfly

Done with the IPv6 validation. Welcome to raise any comments.

}

ipam := &types.IPAM{
Driver: "default",
Config: []types.IPAMConfig{ipamV4Conf},
}

if config.IPv6 {
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 if we support ipv6, we should modify common function, instead of this way:

if ipv6 {
    ......
} else {
    ......
}

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated according to your comments :-)

@@ -206,7 +206,7 @@ func (h *Handle) getCopy() *Handle {

// SetAnyInRange atomically sets the first unset bit in the specified range in the sequence and returns the corresponding ordinal
func (h *Handle) SetAnyInRange(start, end uint64, serial bool) (uint64, error) {
if end < start || end >= h.bits {
if end < start || end > h.bits {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Have you update the vendor libnetwork?

Copy link
Collaborator

@rudyfly rudyfly Nov 6, 2018

Choose a reason for hiding this comment

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

We have vendored the libnetwork is the alibaba libnetwork, you can see: https://github.com/alibaba/libnetwork, if you want to modify it, you can send PR to our libnetwork`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. please help to merge. thanks.


// init host bridge network.
_, err = initBridgeDevice(bridgeName, ipNet)
_, err = initBridgeDevice(bridgeName, ipv4Net)
Copy link
Collaborator

Choose a reason for hiding this comment

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

bridge device should support ipv6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rudyfly

Bridge device already supported IPv6 since it deferred the IPv6 allocation by libnetwork IPAM module. So I think that there is no need to add assign bridge IPv6 address in here. WDYT ?

Intergration-test might be blocked by other test suite. So I'll work on the integration-test if upstream integration-test is ready.

Currently could you help to merge the PR to alibaba/libnetwork firstly? then I can vendor the new commit to build the integration-test.

For the failure of the upstream pouch integration-test. I also Cc'ed @allencloud
Steps:

$mkdir -p $GOPATH/src/github.com/alibaba && git clone https://github.com/alibaba/pouch
$cd $GOPATH/src/github.com/alibaba/pouch && make build-integration-test
$make integration-test
integration-test
./hack/testing/run_daemon_integration.sh
stop local-persist volume plugin...
start local-persist volume plugin...
stop pouch daemon...
start pouch daemon...
failed to start pouch daemon in background!
make: *** [integration-test] Error 1

@rudyfly
Copy link
Collaborator

rudyfly commented Nov 7, 2018

Could you add integration test for ipv6? and rebase and merge your commits?

@houstar
Copy link
Contributor Author

houstar commented Nov 7, 2018

Could you add integration test for ipv6?

OK. I will cover these integration test.

and rebase and merge your commits?

Is it rebase and merge above commits into one commit ?

@rudyfly
Copy link
Collaborator

rudyfly commented Nov 7, 2018

@houstar
and rebase and merge your commits?

Is it rebase and merge above commits into one commit ?

yes

@houstar
Copy link
Contributor Author

houstar commented Nov 8, 2018

Modified as your recommendation. Thanks for your carefully review

/assign

@houstar
Copy link
Contributor Author

houstar commented Nov 9, 2018

@rudyfly Done with the network integration-test, could you help review and merge ?

  272 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:111: PouchNetworkSuite.TestNetworkBridgeWorks 22.402s
  273 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:441: PouchNetworkSuite.TestNetworkConnect 5.349s
  274 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:519: PouchNetworkSuite.TestNetworkConnectWithRestart  3.788s
  275 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:349: PouchNetworkSuite.TestNetworkCreateDup   0.255s
  276 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:247: PouchNetworkSuite.TestNetworkCreateWithLabel 0.416s
  277 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:298: PouchNetworkSuite.TestNetworkCreateWithOption    0.411s
  278 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:227: PouchNetworkSuite.TestNetworkCreateWrongDriver   15.099s
  279 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:59: PouchNetworkSuite.TestNetworkDefault  6.031s
  280 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:486: PouchNetworkSuite.TestNetworkDisconnect  4.313s
  281 PASS: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:35: PouchNetworkSuite.TestNetworkInspectFormat    0.186s
  282
  283 ----------------------------------------------------------------------
  284 FAIL: /root/src/github.com/alibaba/pouch/test/cli_network_test.go:383: PouchNetworkSuite.TestNetworkPortMapping
  285
  286 /root/src/github.com/alibaba/pouch/test/cli_network_test.go:415:
  287     c.Assert(success, check.Equals, true)
  288 ... obtained bool = false
  289 ... expected bool = true

@houstar
Copy link
Contributor Author

houstar commented Nov 15, 2018

@rudyfly Any new comments?

GatewayIPv4 string `json:"default-gateway,omitempty"`
IPv6 bool `json:"ipv6,omitempty"`
Copy link
Collaborator

@rudyfly rudyfly Nov 19, 2018

Choose a reason for hiding this comment

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

s/IPv6/EnableIPv6
and also change it in json format
WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. got it

@rudyfly
Copy link
Collaborator

rudyfly commented Nov 19, 2018

@houstar I'm sorry to late to review this pr, because of kubecon.
I have tested it on my ubuntu, it works,
Also need rebase master, and then LGTM.

Signed-off-by: Leno Hou <lenohou@gmail.com>
* add ipv6 and fixed-cidr-v6 Daemon flag
* add IPv6 validation and integration test

Signed-off-by: Leno Hou <lenohou@gmail.com>
@houstar
Copy link
Contributor Author

houstar commented Nov 19, 2018

@rudyfly Take it easy, man . ~~~~ . :~)

@rudyfly
Copy link
Collaborator

rudyfly commented Nov 19, 2018

LGTM

@rudyfly rudyfly merged commit e7dc811 into AliyunContainerService:master Nov 19, 2018
@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Nov 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
areas/network kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: enable ipv6 on pouch
4 participants