diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-10-13 18:42:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 18:42:15 +0200 |
commit | a235f43ac05ad30aeb6f85ba79755d5529d49e1b (patch) | |
tree | b6682214ddfc3a58a0bd628aed617b4d66d63737 /libpod/network | |
parent | 1c156f22678b3f476ea78fa9e22982c66a7e1559 (diff) | |
parent | cead185373b0dabe2226d56bbd8d9e2b4edeb8eb (diff) | |
download | podman-a235f43ac05ad30aeb6f85ba79755d5529d49e1b.tar.gz podman-a235f43ac05ad30aeb6f85ba79755d5529d49e1b.tar.bz2 podman-a235f43ac05ad30aeb6f85ba79755d5529d49e1b.zip |
Merge pull request #11949 from Luap99/net-range
CNI: fix network create --ip-range
Diffstat (limited to 'libpod/network')
-rw-r--r-- | libpod/network/cni/cni_types.go | 2 | ||||
-rw-r--r-- | libpod/network/cni/config_test.go | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/libpod/network/cni/cni_types.go b/libpod/network/cni/cni_types.go index fbf917c2d..87beceff3 100644 --- a/libpod/network/cni/cni_types.go +++ b/libpod/network/cni/cni_types.go @@ -182,7 +182,7 @@ func newIPAMLocalHostRange(subnet types.IPNet, leaseRange *types.LeaseRange, gw hostRange.RangeStart = leaseRange.StartIP.String() } if leaseRange.EndIP != nil { - hostRange.RangeStart = leaseRange.EndIP.String() + hostRange.RangeEnd = leaseRange.EndIP.String() } } diff --git a/libpod/network/cni/config_test.go b/libpod/network/cni/config_test.go index 5181cd900..0dfc6173c 100644 --- a/libpod/network/cni/config_test.go +++ b/libpod/network/cni/config_test.go @@ -621,7 +621,7 @@ var _ = Describe("Config", func() { err = libpodNet.NetworkRemove(network1.Name) Expect(err).To(BeNil()) - endIP := "10.0.0.10" + endIP := "10.0.0.30" network = types.Network{ Driver: "bridge", Subnets: []types.Subnet{ @@ -665,6 +665,22 @@ var _ = Describe("Config", func() { Expect(network1.Subnets[0].Gateway.String()).To(Equal("10.0.0.1")) Expect(network1.Subnets[0].LeaseRange.StartIP.String()).To(Equal(startIP)) Expect(network1.Subnets[0].LeaseRange.EndIP.String()).To(Equal(endIP)) + + // create a new interface to force a config load from disk + libpodNet, err = getNetworkInterface(cniConfDir, false) + Expect(err).To(BeNil()) + + network1, err = libpodNet.NetworkInspect(network1.Name) + Expect(err).To(BeNil()) + Expect(network1.Name).ToNot(BeEmpty()) + Expect(network1.ID).ToNot(BeEmpty()) + Expect(network1.NetworkInterface).ToNot(BeEmpty()) + Expect(network1.Driver).To(Equal("bridge")) + Expect(network1.Subnets).To(HaveLen(1)) + Expect(network1.Subnets[0].Subnet.String()).To(Equal(subnet)) + Expect(network1.Subnets[0].Gateway.String()).To(Equal("10.0.0.1")) + Expect(network1.Subnets[0].LeaseRange.StartIP.String()).To(Equal(startIP)) + Expect(network1.Subnets[0].LeaseRange.EndIP.String()).To(Equal(endIP)) }) It("create bridge with subnet and invalid lease range", func() { |