From edf0e918e32f4f109329881310b798f3b2c7defb Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 16 Dec 2020 20:28:07 +0100 Subject: Always add the default gateway to the cni config file `podman network create` should always add a gateway to the cni config. If no gateway is given use the first ip in the subnet. CNI does not require the gateway field but we need it because of network inspect. This worked with previous version but was dropped in Commit(e7a72d72fd59). Fixes #8748 Signed-off-by: Paul Holzinger --- test/e2e/network_create_test.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index 21b3074fc..7e9a18ab2 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -106,6 +106,7 @@ var _ = Describe("Podman network create", func() { Expect(bridgePlugin.IPAM.Routes[0].Dest).To(Equal("0.0.0.0/0")) Expect(bridgePlugin.IsGW).To(BeTrue()) Expect(bridgePlugin.IPMasq).To(BeTrue()) + Expect(bridgePlugin.IPAM.Ranges[0][0].Gateway).ToNot(BeEmpty()) Expect(portMapPlugin.Capabilities["portMappings"]).To(BeTrue()) }) @@ -153,6 +154,8 @@ var _ = Describe("Podman network create", func() { // JSON the bridge info bridgePlugin, err := genericPluginsToBridge(result["plugins"], "bridge") Expect(err).To(BeNil()) + // check that gateway is added to config + Expect(bridgePlugin.IPAM.Ranges[0][0].Gateway).To(Equal("10.11.12.1")) // Once a container executes a new network, the nic will be created. We should clean those up // best we can -- cgit v1.2.3-54-g00ecf