mirror of
https://github.com/moby/moby.git
synced 2026-08-05 07:30:57 +00:00
EnableIPv4:false is no longer --experimental
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user