From 6bb69a21bf87ee298ec2240e84c41351276dcd50 Mon Sep 17 00:00:00 2001 From: Rob Murray Date: Wed, 31 Jul 2024 16:50:55 +0100 Subject: [PATCH] EnableIPv4:false is no longer --experimental Signed-off-by: Rob Murray --- api/swagger.yaml | 4 +--- daemon/network.go | 5 ---- integration/network/dns_test.go | 1 - integration/network/ipvlan/ipvlan_test.go | 26 +++------------------ integration/network/macvlan/macvlan_test.go | 26 +++------------------ integration/network/nat/nat_windows_test.go | 6 +---- integration/network/network_linux_test.go | 3 +-- integration/networking/bridge_linux_test.go | 4 ++-- integration/service/network_test.go | 3 +-- 9 files changed, 12 insertions(+), 66 deletions(-) diff --git a/api/swagger.yaml b/api/swagger.yaml index 499b1af205..829e9a058e 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -11285,9 +11285,7 @@ paths: description: "Optional custom IP scheme for the network." $ref: "#/definitions/IPAM" EnableIPv4: - description: | - Enable IPv4 on the network. - To disable IPv4, the daemon must be started with experimental features enabled. + description: "Enable IPv4 on the network." type: "boolean" example: true EnableIPv6: diff --git a/daemon/network.go b/daemon/network.go index 0086611208..44a7255fb3 100644 --- a/daemon/network.go +++ b/daemon/network.go @@ -319,11 +319,6 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create networktypes.Crea return nil, errdefs.InvalidParameter(fmt.Errorf("driver-opt %q is not a valid bool", netlabel.EnableIPv4)) } } - if !enableIPv4 && !daemon.config().Experimental && create.ConfigFrom == nil { - return nil, errdefs.InvalidParameter( - errors.New("IPv4 can only be disabled if experimental features are enabled"), - ) - } var enableIPv6 bool if create.EnableIPv6 != nil { diff --git a/integration/network/dns_test.go b/integration/network/dns_test.go index 1385a22b5c..85bb552dcc 100644 --- a/integration/network/dns_test.go +++ b/integration/network/dns_test.go @@ -104,7 +104,6 @@ func TestExtDNSInIPv6OnlyNw(t *testing.T) { // Set up a temp resolv.conf pointing at that DNS server, and a daemon using it. d := daemon.New(t, daemon.WithResolvConf(network.GenResolvConf("127.0.0.1")), - daemon.WithExperimental(), ) d.StartWithBusybox(ctx, t) defer d.Stop(t) diff --git a/integration/network/ipvlan/ipvlan_test.go b/integration/network/ipvlan/ipvlan_test.go index bf8c7d376e..1ab74f4726 100644 --- a/integration/network/ipvlan/ipvlan_test.go +++ b/integration/network/ipvlan/ipvlan_test.go @@ -95,9 +95,6 @@ func TestDockerNetworkIpvlan(t *testing.T) { }, { name: "L3Addressing", test: testIpvlanL3Addressing, - }, { - name: "IpvlanExperimentalV4Only", - test: testIpvlanExperimentalV4Only, }, } { t.Run(tc.name, func(t *testing.T) { @@ -444,18 +441,6 @@ func testIpvlanL3Addressing(t *testing.T, ctx context.Context, client dclient.AP assert.Check(t, is.Contains(result.Combined(), "default dev eth0")) } -// Check that '--ipv4=false' is only allowed with '--experimental'. -// (Remember to remove `--experimental' from TestMacvlanIPAM when it's -// no longer needed, and maybe use a single daemon for all of its tests.) -func testIpvlanExperimentalV4Only(t *testing.T, ctx context.Context, client dclient.APIClient) { - _, err := net.Create(ctx, client, "testnet", - net.WithIPvlan("", "l3"), - net.WithIPv4(false), - ) - defer client.NetworkRemove(ctx, "testnet") - assert.ErrorContains(t, err, "IPv4 can only be disabled if experimental features are enabled") -} - // Check that an ipvlan interface with '--ipv6=false' doesn't get kernel-assigned // IPv6 addresses, but the loopback interface does still have an IPv6 address ('::1'). // Also check that with '--ipv4=false', there's no IPAM-assigned IPv4 address. @@ -464,6 +449,9 @@ func TestIpvlanIPAM(t *testing.T) { skip.If(t, testEnv.IsRootless, "rootless mode has different view of network") ctx := testutil.StartSpan(baseContext, t) + d := daemon.New(t) + d.StartWithBusybox(ctx, t) + defer d.Stop(t) tests := []struct { name string @@ -499,14 +487,6 @@ func TestIpvlanIPAM(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { ctx := testutil.StartSpan(ctx, t) - - var daemonOpts []daemon.Option - if !tc.enableIPv4 { - daemonOpts = append(daemonOpts, daemon.WithExperimental()) - } - d := daemon.New(t, daemonOpts...) - d.StartWithBusybox(ctx, t) - t.Cleanup(func() { d.Stop(t) }) c := d.NewClientT(t, dclient.WithVersion(tc.apiVersion)) netOpts := []func(*network.CreateOptions){ diff --git a/integration/network/macvlan/macvlan_test.go b/integration/network/macvlan/macvlan_test.go index 4817347b84..8b8b9e1d4c 100644 --- a/integration/network/macvlan/macvlan_test.go +++ b/integration/network/macvlan/macvlan_test.go @@ -90,9 +90,6 @@ func TestDockerNetworkMacvlan(t *testing.T) { }, { name: "Addressing", test: testMacvlanAddressing, - }, { - name: "MacvlanExperimentalV4Only", - test: testMacvlanExperimentalV4Only, }, } { t.Run(tc.name, func(t *testing.T) { @@ -440,18 +437,6 @@ func testMacvlanAddressing(t *testing.T, ctx context.Context, client client.APIC assert.Check(t, is.Contains(result.Combined(), "default via 2001:db8:abca::254 dev eth0")) } -// Check that '--ipv4=false' is only allowed with '--experimental'. -// (Remember to remove `--experimental' from TestMacvlanIPAM when it's -// no longer needed, and maybe use a single daemon for all of its tests.) -func testMacvlanExperimentalV4Only(t *testing.T, ctx context.Context, client client.APIClient) { - _, err := net.Create(ctx, client, "testnet", - net.WithMacvlan(""), - net.WithIPv4(false), - ) - defer client.NetworkRemove(ctx, "testnet") - assert.ErrorContains(t, err, "IPv4 can only be disabled if experimental features are enabled") -} - // Check that a macvlan interface with '--ipv6=false' doesn't get kernel-assigned // IPv6 addresses, but the loopback interface does still have an IPv6 address ('::1'). // Also check that with '--ipv4=false', there's no IPAM-assigned IPv4 address. @@ -460,6 +445,9 @@ func TestMacvlanIPAM(t *testing.T) { skip.If(t, testEnv.IsRootless, "rootless mode has different view of network") ctx := testutil.StartSpan(baseContext, t) + d := daemon.New(t) + d.StartWithBusybox(ctx, t) + defer d.Stop(t) testcases := []struct { name string @@ -495,14 +483,6 @@ func TestMacvlanIPAM(t *testing.T) { for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { ctx := testutil.StartSpan(ctx, t) - - var daemonOpts []daemon.Option - if !tc.enableIPv4 { - daemonOpts = append(daemonOpts, daemon.WithExperimental()) - } - d := daemon.New(t, daemonOpts...) - d.StartWithBusybox(ctx, t) - t.Cleanup(func() { d.Stop(t) }) c := d.NewClientT(t, client.WithVersion(tc.apiVersion)) netOpts := []func(*network.CreateOptions){ diff --git a/integration/network/nat/nat_windows_test.go b/integration/network/nat/nat_windows_test.go index 61e071e60e..5589b53832 100644 --- a/integration/network/nat/nat_windows_test.go +++ b/integration/network/nat/nat_windows_test.go @@ -16,9 +16,5 @@ func TestWindowsNoDisableIPv4(t *testing.T) { network.WithDriver("nat"), network.WithIPv4(false), ) - // This error message should change to "IPv4 cannot be disabled on Windows" - // when "--experimental" is no longer required to disable IPv4. But, there's - // no way to start a second daemon with "--experimental" in Windows CI. - assert.Check(t, is.ErrorContains(err, - "IPv4 can only be disabled if experimental features are enabled")) + assert.Check(t, is.ErrorContains(err, "IPv4 cannot be disabled on Windows")) } diff --git a/integration/network/network_linux_test.go b/integration/network/network_linux_test.go index eb27c28591..1e7244d2e8 100644 --- a/integration/network/network_linux_test.go +++ b/integration/network/network_linux_test.go @@ -438,8 +438,7 @@ func TestMixL3IPVlanAndBridge(t *testing.T) { t.Run(tc.name, func(t *testing.T) { ctx := testutil.StartSpan(ctx, t) - // experimental is needed for a WithIPv4(false) network. - d := daemon.New(t, daemon.WithExperimental()) + d := daemon.New(t) var daemonArgs []string if tc.liveRestore { daemonArgs = append(daemonArgs, "--live-restore") diff --git a/integration/networking/bridge_linux_test.go b/integration/networking/bridge_linux_test.go index 553ad194be..7bf4ff7322 100644 --- a/integration/networking/bridge_linux_test.go +++ b/integration/networking/bridge_linux_test.go @@ -781,7 +781,7 @@ func TestDisableIPv6Addrs(t *testing.T) { // IPv4 addresses. func TestDisableIPv4(t *testing.T) { ctx := setupTest(t) - d := daemon.New(t, daemon.WithExperimental()) + d := daemon.New(t) d.StartWithBusybox(ctx, t) defer d.Stop(t) @@ -1126,7 +1126,7 @@ func TestGatewaySelection(t *testing.T) { skip.If(t, testEnv.IsRootless, "proxies run in child namespace") ctx := setupTest(t) - d := daemon.New(t, daemon.WithExperimental()) + d := daemon.New(t) d.StartWithBusybox(ctx, t) defer d.Stop(t) c := d.NewClientT(t) diff --git a/integration/service/network_test.go b/integration/service/network_test.go index a8dd2e955c..eb852d06fd 100644 --- a/integration/service/network_test.go +++ b/integration/service/network_test.go @@ -9,7 +9,6 @@ import ( "github.com/docker/docker/integration/internal/container" net "github.com/docker/docker/integration/internal/network" "github.com/docker/docker/integration/internal/swarm" - "github.com/docker/docker/testutil/daemon" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" "gotest.tools/v3/skip" @@ -122,7 +121,7 @@ func TestSwarmNoDisableIPv4(t *testing.T) { skip.If(t, testEnv.DaemonInfo.OSType == "windows") ctx := setupTest(t) - d := swarm.NewSwarm(ctx, t, testEnv, daemon.WithExperimental()) + d := swarm.NewSwarm(ctx, t, testEnv) defer d.Stop(t) client := d.NewClientT(t) defer client.Close()