diff options
author | Antonio Ojea <aojea@redhat.com> | 2020-08-14 11:19:02 +0200 |
---|---|---|
committer | Antonio Ojea <aojea@redhat.com> | 2020-08-15 12:11:01 +0200 |
commit | 07e3f1bba9674c0cb93a0fa260930bfebbf75728 (patch) | |
tree | 12a096d58c7903839eaf39ceb889415129e91426 /test/e2e | |
parent | d777a7bd5c920ce3cf06c4eba25068747dbc6b8f (diff) | |
download | podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.gz podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.tar.bz2 podman-07e3f1bba9674c0cb93a0fa260930bfebbf75728.zip |
podman support for IPv6 networks
podman containers using IPv6 were missing the default route, breaking
deployments trying to use them.
The problem is that the default route was hardcoded to IPv4, this
takes into consideration the podman subnet IP family to generate
the corresponding default route.
Signed-off-by: Antonio Ojea <aojea@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/network_create_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index fcd324cd1..f97e6c1f1 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -178,6 +178,47 @@ var _ = Describe("Podman network create", func() { Expect(subnet.Contains(containerIP)).To(BeTrue()) }) + It("podman network create with name and IPv6 subnet", func() { + SkipIfRemote() + var ( + results []network.NcList + ) + nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:1:2:3:4::/64", "newIPv6network"}) + nc.WaitWithDefaultTimeout() + Expect(nc.ExitCode()).To(BeZero()) + + defer podmanTest.removeCNINetwork("newIPv6network") + + // Inspect the network configuration + inspect := podmanTest.Podman([]string{"network", "inspect", "newIPv6network"}) + inspect.WaitWithDefaultTimeout() + + // JSON the network configuration into something usable + err := json.Unmarshal([]byte(inspect.OutputToString()), &results) + Expect(err).To(BeNil()) + result := results[0] + Expect(result["name"]).To(Equal("newIPv6network")) + + // JSON the bridge info + bridgePlugin, err := genericPluginsToBridge(result["plugins"], "bridge") + Expect(err).To(BeNil()) + Expect(bridgePlugin.IPAM.Routes[0].Dest).To(Equal("::/0")) + + // Once a container executes a new network, the nic will be created. We should clean those up + // best we can + defer removeNetworkDevice(bridgePlugin.BrName) + + try := podmanTest.Podman([]string{"run", "-it", "--rm", "--network", "newIPv6network", ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"}) + try.WaitWithDefaultTimeout() + + _, subnet, err := net.ParseCIDR("fd00:1:2:3:4::/64") + Expect(err).To(BeNil()) + containerIP, _, err := net.ParseCIDR(try.OutputToString()) + Expect(err).To(BeNil()) + // Ensure that the IP the container got is within the subnet the user asked for + Expect(subnet.Contains(containerIP)).To(BeTrue()) + }) + It("podman network create with invalid subnet", func() { nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.12.0/17000", "fail"}) nc.WaitWithDefaultTimeout() |