Change:
// TestInvocationWithoutRuntime invokes the plugin without a runtime. // This is how kubenet is invoked from the cri. func TestTearDownWithoutRuntime(t *testing.T) { <del> fhost := nettest.NewFakeHost(nil) fhost.Legacy = false fhost.Runtime = nil mockcni := &mock_cni.MockCNI{} fexec := &exec.FakeExec{ CommandScript: []exec.FakeCommandAction{}, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil </del> <ins> testCases := []struct { podCIDR         string ip              string expectedGateway string }{ { podCIDR:         "10.0.0.1/24", ip:              "10.0.0.1", expectedGateway: "10.0.0.1", }, { podCIDR:         "2001:beef::1/48", ip:              "2001:beef::1", expectedGateway: "2001:beef::1", </ins> }, } <ins> for _, tc := range testCases { fhost := nettest.NewFakeHost(nil) fhost.Legacy = false fhost.Runtime = nil mockcni := &mock_cni.MockCNI{} fexec := &exec.FakeExec{ CommandScript: []exec.FakeCommandAction{}, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil }, } </ins> <del> kubenet := newFakeKubenetPlugin(map[kubecontainer.ContainerID]string{}, fexec, fhost) kubenet.cniConfig = mockcni kubenet.iptables = ipttest.NewFake() </del> <ins> kubenet := newFakeKubenetPlugin(map[kubecontainer.ContainerID]string{}, fexec, fhost) kubenet.cniConfig = mockcni kubenet.iptables = ipttest.NewFake() </ins> <del> details := make(map[string]interface{}) details[network.NET_PLUGIN_EVENT_POD_CIDR_CHANGE_DETAIL_CIDR] = "10.0.0.1/24" kubenet.Event(network.NET_PLUGIN_EVENT_POD_CIDR_CHANGE, details) </del> <ins> details := make(map[string]interface{}) details[network.NET_PLUGIN_EVENT_POD_CIDR_CHANGE_DETAIL_CIDR] = tc.podCIDR kubenet.Event(network.NET_PLUGIN_EVENT_POD_CIDR_CHANGE, details) </ins> <del> existingContainerID := kubecontainer.BuildContainerID("docker", "123") kubenet.podIPs[existingContainerID] = "10.0.0.1" </del> <ins> if kubenet.gateway.String() != tc.expectedGateway { t.Errorf("generated gateway: %q, expecting: %q", kubenet.gateway.String(), tc.expectedGateway) } if kubenet.podCidr != tc.podCIDR { t.Errorf("generated podCidr: %q, expecting: %q", kubenet.podCidr, tc.podCIDR) } existingContainerID := kubecontainer.BuildContainerID("docker", "123") kubenet.podIPs[existingContainerID] = tc.ip </ins> <del> mockcni.On("DelNetwork", mock.AnythingOfType("*libcni.NetworkConfig"), mock.AnythingOfType("*libcni.RuntimeConf")).Return(nil) </del> <ins> mockcni.On("DelNetwork", mock.AnythingOfType("*libcni.NetworkConfig"), mock.AnythingOfType("*libcni.RuntimeConf")).Return(nil) </ins> <del> if err := kubenet.TearDownPod("namespace", "name", existingContainerID); err != nil { t.Fatalf("Unexpected error in TearDownPod: %v", err) </del> <ins> if err := kubenet.TearDownPod("namespace", "name", existingContainerID); err != nil { t.Fatalf("Unexpected error in TearDownPod: %v", err) } // Assert that the CNI DelNetwork made it through and we didn't crash // without a runtime. mockcni.AssertExpectations(t) </ins> } <del> // Assert that the CNI DelNetwork made it through and we didn't crash // without a runtime. mockcni.AssertExpectations(t) </del> } //TODO: add unit test for each implementation of network plugin interface

Discussion:
<!-- This form is for bug reports and feature requests ONLY! If you're looking for help check and the . --Is this a BUG REPORT or FEATURE REQUEST?: BUG REPORT What happened: Using Kubenet with IPv6 causes a panic panic: runtime error: index out of range goroutine 625 [running]: (kubenetNetworkPlugin).Event(0xc4203bf440, 0x462ebd1, 0xf, 0xc4219deae0) +0x889 This is due to IPv4 specific code in What you expected to happen: Kubenet should support IPv6 How to reproduce it (as minimally and precisely as possible): Running local-up-, use kubenet, and set the parameters for kubenet with ipv6 nodecidrargs="--allocate-node-cidrs=true --cluster-cidr=2001:beef::/48 --node-cidr-mask-size=64 " Anything else we need to know?: Environment: Kubernetes version (use ): latest as of June 26, 2017 Cloud provider or hardware configuration*: local on a VM OS (e.g. from /etc/os-release): CentOS Kernel (e.g. ): Linux localhost.localdomain 3.10.0-514.el7.x8664 SMP Tue Nov 22 16:42:41 UTC 2016 x8664 x8664 x86_64 GNU/Linux Install tools: Others:
There are no sig labels on this issue. Please by:<br(1) mentioning a sig: <bre.g., for API Machinery<br(2) specifying the label manually: <bre.g., for sig/scalability<br<brNote: method (1) will trigger a notification to the team. You can find the team list and label list
/area ipv6
/sig network /remove-sig api-machinery
/assign