Browse code

EnableIPv4:false is no longer --experimental

Signed-off-by: Rob Murray <rob.murray@docker.com>

Rob Murray authored on 2024/08/01 00:50:55
Showing 9 changed files
... ...
@@ -11285,9 +11285,7 @@ paths:
11285 11285
                 description: "Optional custom IP scheme for the network."
11286 11286
                 $ref: "#/definitions/IPAM"
11287 11287
               EnableIPv4:
11288
-                description: |
11289
-                  Enable IPv4 on the network.
11290
-                  To disable IPv4, the daemon must be started with experimental features enabled.
11288
+                description: "Enable IPv4 on the network."
11291 11289
                 type: "boolean"
11292 11290
                 example: true
11293 11291
               EnableIPv6:
... ...
@@ -319,11 +319,6 @@ func (daemon *Daemon) createNetwork(cfg *config.Config, create networktypes.Crea
319 319
 			return nil, errdefs.InvalidParameter(fmt.Errorf("driver-opt %q is not a valid bool", netlabel.EnableIPv4))
320 320
 		}
321 321
 	}
322
-	if !enableIPv4 && !daemon.config().Experimental && create.ConfigFrom == nil {
323
-		return nil, errdefs.InvalidParameter(
324
-			errors.New("IPv4 can only be disabled if experimental features are enabled"),
325
-		)
326
-	}
327 322
 
328 323
 	var enableIPv6 bool
329 324
 	if create.EnableIPv6 != nil {
... ...
@@ -104,7 +104,6 @@ func TestExtDNSInIPv6OnlyNw(t *testing.T) {
104 104
 	// Set up a temp resolv.conf pointing at that DNS server, and a daemon using it.
105 105
 	d := daemon.New(t,
106 106
 		daemon.WithResolvConf(network.GenResolvConf("127.0.0.1")),
107
-		daemon.WithExperimental(),
108 107
 	)
109 108
 	d.StartWithBusybox(ctx, t)
110 109
 	defer d.Stop(t)
... ...
@@ -95,9 +95,6 @@ func TestDockerNetworkIpvlan(t *testing.T) {
95 95
 		}, {
96 96
 			name: "L3Addressing",
97 97
 			test: testIpvlanL3Addressing,
98
-		}, {
99
-			name: "IpvlanExperimentalV4Only",
100
-			test: testIpvlanExperimentalV4Only,
101 98
 		},
102 99
 	} {
103 100
 		t.Run(tc.name, func(t *testing.T) {
... ...
@@ -444,18 +441,6 @@ func testIpvlanL3Addressing(t *testing.T, ctx context.Context, client dclient.AP
444 444
 	assert.Check(t, is.Contains(result.Combined(), "default dev eth0"))
445 445
 }
446 446
 
447
-// Check that '--ipv4=false' is only allowed with '--experimental'.
448
-// (Remember to remove `--experimental' from TestMacvlanIPAM when it's
449
-// no longer needed, and maybe use a single daemon for all of its tests.)
450
-func testIpvlanExperimentalV4Only(t *testing.T, ctx context.Context, client dclient.APIClient) {
451
-	_, err := net.Create(ctx, client, "testnet",
452
-		net.WithIPvlan("", "l3"),
453
-		net.WithIPv4(false),
454
-	)
455
-	defer client.NetworkRemove(ctx, "testnet")
456
-	assert.ErrorContains(t, err, "IPv4 can only be disabled if experimental features are enabled")
457
-}
458
-
459 447
 // Check that an ipvlan interface with '--ipv6=false' doesn't get kernel-assigned
460 448
 // IPv6 addresses, but the loopback interface does still have an IPv6 address ('::1').
461 449
 // Also check that with '--ipv4=false', there's no IPAM-assigned IPv4 address.
... ...
@@ -464,6 +449,9 @@ func TestIpvlanIPAM(t *testing.T) {
464 464
 	skip.If(t, testEnv.IsRootless, "rootless mode has different view of network")
465 465
 
466 466
 	ctx := testutil.StartSpan(baseContext, t)
467
+	d := daemon.New(t)
468
+	d.StartWithBusybox(ctx, t)
469
+	defer d.Stop(t)
467 470
 
468 471
 	tests := []struct {
469 472
 		name       string
... ...
@@ -499,14 +487,6 @@ func TestIpvlanIPAM(t *testing.T) {
499 499
 	for _, tc := range tests {
500 500
 		t.Run(tc.name, func(t *testing.T) {
501 501
 			ctx := testutil.StartSpan(ctx, t)
502
-
503
-			var daemonOpts []daemon.Option
504
-			if !tc.enableIPv4 {
505
-				daemonOpts = append(daemonOpts, daemon.WithExperimental())
506
-			}
507
-			d := daemon.New(t, daemonOpts...)
508
-			d.StartWithBusybox(ctx, t)
509
-			t.Cleanup(func() { d.Stop(t) })
510 502
 			c := d.NewClientT(t, dclient.WithVersion(tc.apiVersion))
511 503
 
512 504
 			netOpts := []func(*network.CreateOptions){
... ...
@@ -90,9 +90,6 @@ func TestDockerNetworkMacvlan(t *testing.T) {
90 90
 		}, {
91 91
 			name: "Addressing",
92 92
 			test: testMacvlanAddressing,
93
-		}, {
94
-			name: "MacvlanExperimentalV4Only",
95
-			test: testMacvlanExperimentalV4Only,
96 93
 		},
97 94
 	} {
98 95
 		t.Run(tc.name, func(t *testing.T) {
... ...
@@ -440,18 +437,6 @@ func testMacvlanAddressing(t *testing.T, ctx context.Context, client client.APIC
440 440
 	assert.Check(t, is.Contains(result.Combined(), "default via 2001:db8:abca::254 dev eth0"))
441 441
 }
442 442
 
443
-// Check that '--ipv4=false' is only allowed with '--experimental'.
444
-// (Remember to remove `--experimental' from TestMacvlanIPAM when it's
445
-// no longer needed, and maybe use a single daemon for all of its tests.)
446
-func testMacvlanExperimentalV4Only(t *testing.T, ctx context.Context, client client.APIClient) {
447
-	_, err := net.Create(ctx, client, "testnet",
448
-		net.WithMacvlan(""),
449
-		net.WithIPv4(false),
450
-	)
451
-	defer client.NetworkRemove(ctx, "testnet")
452
-	assert.ErrorContains(t, err, "IPv4 can only be disabled if experimental features are enabled")
453
-}
454
-
455 443
 // Check that a macvlan interface with '--ipv6=false' doesn't get kernel-assigned
456 444
 // IPv6 addresses, but the loopback interface does still have an IPv6 address ('::1').
457 445
 // Also check that with '--ipv4=false', there's no IPAM-assigned IPv4 address.
... ...
@@ -460,6 +445,9 @@ func TestMacvlanIPAM(t *testing.T) {
460 460
 	skip.If(t, testEnv.IsRootless, "rootless mode has different view of network")
461 461
 
462 462
 	ctx := testutil.StartSpan(baseContext, t)
463
+	d := daemon.New(t)
464
+	d.StartWithBusybox(ctx, t)
465
+	defer d.Stop(t)
463 466
 
464 467
 	testcases := []struct {
465 468
 		name       string
... ...
@@ -495,14 +483,6 @@ func TestMacvlanIPAM(t *testing.T) {
495 495
 	for _, tc := range testcases {
496 496
 		t.Run(tc.name, func(t *testing.T) {
497 497
 			ctx := testutil.StartSpan(ctx, t)
498
-
499
-			var daemonOpts []daemon.Option
500
-			if !tc.enableIPv4 {
501
-				daemonOpts = append(daemonOpts, daemon.WithExperimental())
502
-			}
503
-			d := daemon.New(t, daemonOpts...)
504
-			d.StartWithBusybox(ctx, t)
505
-			t.Cleanup(func() { d.Stop(t) })
506 498
 			c := d.NewClientT(t, client.WithVersion(tc.apiVersion))
507 499
 
508 500
 			netOpts := []func(*network.CreateOptions){
... ...
@@ -16,9 +16,5 @@ func TestWindowsNoDisableIPv4(t *testing.T) {
16 16
 		network.WithDriver("nat"),
17 17
 		network.WithIPv4(false),
18 18
 	)
19
-	// This error message should change to "IPv4 cannot be disabled on Windows"
20
-	// when "--experimental" is no longer required to disable IPv4. But, there's
21
-	// no way to start a second daemon with "--experimental" in Windows CI.
22
-	assert.Check(t, is.ErrorContains(err,
23
-		"IPv4 can only be disabled if experimental features are enabled"))
19
+	assert.Check(t, is.ErrorContains(err, "IPv4 cannot be disabled on Windows"))
24 20
 }
... ...
@@ -438,8 +438,7 @@ func TestMixL3IPVlanAndBridge(t *testing.T) {
438 438
 		t.Run(tc.name, func(t *testing.T) {
439 439
 			ctx := testutil.StartSpan(ctx, t)
440 440
 
441
-			// experimental is needed for a WithIPv4(false) network.
442
-			d := daemon.New(t, daemon.WithExperimental())
441
+			d := daemon.New(t)
443 442
 			var daemonArgs []string
444 443
 			if tc.liveRestore {
445 444
 				daemonArgs = append(daemonArgs, "--live-restore")
... ...
@@ -781,7 +781,7 @@ func TestDisableIPv6Addrs(t *testing.T) {
781 781
 // IPv4 addresses.
782 782
 func TestDisableIPv4(t *testing.T) {
783 783
 	ctx := setupTest(t)
784
-	d := daemon.New(t, daemon.WithExperimental())
784
+	d := daemon.New(t)
785 785
 	d.StartWithBusybox(ctx, t)
786 786
 	defer d.Stop(t)
787 787
 
... ...
@@ -1126,7 +1126,7 @@ func TestGatewaySelection(t *testing.T) {
1126 1126
 	skip.If(t, testEnv.IsRootless, "proxies run in child namespace")
1127 1127
 
1128 1128
 	ctx := setupTest(t)
1129
-	d := daemon.New(t, daemon.WithExperimental())
1129
+	d := daemon.New(t)
1130 1130
 	d.StartWithBusybox(ctx, t)
1131 1131
 	defer d.Stop(t)
1132 1132
 	c := d.NewClientT(t)
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"github.com/docker/docker/integration/internal/container"
10 10
 	net "github.com/docker/docker/integration/internal/network"
11 11
 	"github.com/docker/docker/integration/internal/swarm"
12
-	"github.com/docker/docker/testutil/daemon"
13 12
 	"gotest.tools/v3/assert"
14 13
 	is "gotest.tools/v3/assert/cmp"
15 14
 	"gotest.tools/v3/skip"
... ...
@@ -122,7 +121,7 @@ func TestSwarmNoDisableIPv4(t *testing.T) {
122 122
 	skip.If(t, testEnv.DaemonInfo.OSType == "windows")
123 123
 	ctx := setupTest(t)
124 124
 
125
-	d := swarm.NewSwarm(ctx, t, testEnv, daemon.WithExperimental())
125
+	d := swarm.NewSwarm(ctx, t, testEnv)
126 126
 	defer d.Stop(t)
127 127
 	client := d.NewClientT(t)
128 128
 	defer client.Close()