Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -527,9 +527,9 @@ func validateEndpointSettings(nw *libnetwork.Network, nwName string, epConfig *n |
| 527 | 527 |
// serviceDiscoveryOnDefaultNetwork are removed. |
| 528 | 528 |
if !containertypes.NetworkMode(nwName).IsUserDefined() {
|
| 529 | 529 |
hasStaticAddresses := ipamConfig.IPv4Address.IsValid() || ipamConfig.IPv6Address.IsValid() |
| 530 |
- // On Linux, user specified IP address is accepted only by networks with user specified subnets. |
|
| 530 |
+ // On Linux, user-specified IP address is accepted only by networks with user-specified subnets. |
|
| 531 | 531 |
if hasStaticAddresses && !enableIPOnPredefinedNetwork() {
|
| 532 |
- errs = append(errs, cerrdefs.ErrInvalidArgument.WithMessage("user specified IP address is supported on user defined networks only"))
|
|
| 532 |
+ errs = append(errs, cerrdefs.ErrInvalidArgument.WithMessage("user-specified IP address is supported on user-defined networks only"))
|
|
| 533 | 533 |
} |
| 534 | 534 |
if len(epConfig.Aliases) > 0 && !serviceDiscoveryOnDefaultNetwork() {
|
| 535 | 535 |
errs = append(errs, cerrdefs.ErrInvalidArgument.WithMessage("network-scoped aliases are only supported for user-defined networks"))
|
| ... | ... |
@@ -637,7 +637,7 @@ func cleanOperationalData(es *network.EndpointSettings) {
|
| 637 | 637 |
} |
| 638 | 638 |
|
| 639 | 639 |
func (daemon *Daemon) updateNetworkConfig(ctr *container.Container, n *libnetwork.Network, endpointConfig *networktypes.EndpointSettings) error {
|
| 640 |
- // Set up DNS names for a user defined network, and for the default 'nat' |
|
| 640 |
+ // Set up DNS names for a user-defined network, and for the default 'nat' |
|
| 641 | 641 |
// network on Windows (IsBridge() returns true for nat). |
| 642 | 642 |
if containertypes.NetworkMode(n.Name()).IsUserDefined() || |
| 643 | 643 |
(serviceDiscoveryOnDefaultNetwork() && containertypes.NetworkMode(n.Name()).IsBridge()) {
|
| ... | ... |
@@ -1128,7 +1128,7 @@ func (daemon *Daemon) DeactivateContainerServiceBinding(containerName string) er |
| 1128 | 1128 |
} |
| 1129 | 1129 |
|
| 1130 | 1130 |
func getNetworkID(name string, endpointSettings *networktypes.EndpointSettings) string {
|
| 1131 |
- // We only want to prefer NetworkID for user defined networks. |
|
| 1131 |
+ // We only want to prefer NetworkID for user-defined networks. |
|
| 1132 | 1132 |
// For systems like bridge, none, etc. the name is preferred (otherwise restart may cause issues) |
| 1133 | 1133 |
if containertypes.NetworkMode(name).IsUserDefined() && endpointSettings != nil && endpointSettings.NetworkID != "" {
|
| 1134 | 1134 |
return endpointSettings.NetworkID |
| ... | ... |
@@ -149,7 +149,7 @@ func setExitCodeFromError(setExitCode func(exitStatus), err error) error {
|
| 149 | 149 |
return startInvalidConfigError(errDesc) |
| 150 | 150 |
} |
| 151 | 151 |
|
| 152 |
- // attempted to mount a file onto a directory, or a directory onto a file, maybe from user specified bind mounts |
|
| 152 |
+ // attempted to mount a file onto a directory, or a directory onto a file, maybe from user-specified bind mounts |
|
| 153 | 153 |
if contains(errDesc, syscall.ENOTDIR.Error()) {
|
| 154 | 154 |
errDesc += ": Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type" |
| 155 | 155 |
setExitCode(exitCmdNotFound) |
| ... | ... |
@@ -867,7 +867,7 @@ func (na *cnmNetworkAllocator) allocatePools(n *api.Network) (map[netip.Prefix]s |
| 867 | 867 |
return nil, err |
| 868 | 868 |
} |
| 869 | 869 |
|
| 870 |
- // We don't support user defined address spaces yet so just |
|
| 870 |
+ // We don't support user-defined address spaces yet so just |
|
| 871 | 871 |
// retrieve default address space names for the driver. |
| 872 | 872 |
_, asName, err := ipam.GetDefaultAddressSpaces() |
| 873 | 873 |
if err != nil {
|
| ... | ... |
@@ -117,13 +117,13 @@ const ( |
| 117 | 117 |
ifaceCreatedByUser |
| 118 | 118 |
) |
| 119 | 119 |
|
| 120 |
-// containerConfiguration represents the user specified configuration for a container |
|
| 120 |
+// containerConfiguration represents the user-specified configuration for a container |
|
| 121 | 121 |
type containerConfiguration struct {
|
| 122 | 122 |
ParentEndpoints []string |
| 123 | 123 |
ChildEndpoints []string |
| 124 | 124 |
} |
| 125 | 125 |
|
| 126 |
-// connectivityConfiguration represents the user specified configuration regarding the external connectivity |
|
| 126 |
+// connectivityConfiguration represents the user-specified configuration regarding the external connectivity |
|
| 127 | 127 |
type connectivityConfiguration struct {
|
| 128 | 128 |
PortBindings []portmapperapi.PortBindingReq |
| 129 | 129 |
ExposedPorts []types.TransportPort |
| ... | ... |
@@ -153,7 +153,7 @@ func delVlanLink(linkName string) error {
|
| 153 | 153 |
log.G(context.TODO()).Debugf("Deleted a vlan tagged netlink subinterface: %s", linkName)
|
| 154 | 154 |
} |
| 155 | 155 |
// if the subinterface doesn't parse to iface.vlan_id leave the interface in |
| 156 |
- // place since it could be a user specified name not created by the driver. |
|
| 156 |
+ // place since it could be a user-specified name not created by the driver. |
|
| 157 | 157 |
return nil |
| 158 | 158 |
} |
| 159 | 159 |
|
| ... | ... |
@@ -133,7 +133,7 @@ func delVlanLink(linkName string) error {
|
| 133 | 133 |
log.G(context.TODO()).Debugf("Deleted a vlan tagged netlink subinterface: %s", linkName)
|
| 134 | 134 |
} |
| 135 | 135 |
// if the subinterface doesn't parse to iface.vlan_id leave the interface in |
| 136 |
- // place since it could be a user specified name not created by the driver. |
|
| 136 |
+ // place since it could be a user-specified name not created by the driver. |
|
| 137 | 137 |
return nil |
| 138 | 138 |
} |
| 139 | 139 |
|
| ... | ... |
@@ -56,7 +56,7 @@ type networkConfiguration struct {
|
| 56 | 56 |
OutboundNatExceptions []string |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
-// endpointConfiguration represents the user specified configuration for the sandbox endpoint |
|
| 59 |
+// endpointConfiguration represents the user-specified configuration for the sandbox endpoint |
|
| 60 | 60 |
type endpointOption struct {
|
| 61 | 61 |
MacAddress net.HardwareAddr |
| 62 | 62 |
QosPolicies []types.QosPolicy |
| ... | ... |
@@ -84,8 +84,8 @@ type hnsEndpoint struct {
|
| 84 | 84 |
// when windows properly supports a sandboxID. |
| 85 | 85 |
sandboxID string |
| 86 | 86 |
macAddress net.HardwareAddr |
| 87 |
- epOption *endpointOption // User specified parameters |
|
| 88 |
- epConnectivity *EndpointConnectivity // User specified parameters |
|
| 87 |
+ epOption *endpointOption // User-specified parameters |
|
| 88 |
+ epConnectivity *EndpointConnectivity // User-specified parameters |
|
| 89 | 89 |
portMapping []types.PortBinding // Operation port bindings |
| 90 | 90 |
addr *net.IPNet |
| 91 | 91 |
gateway net.IP |
| ... | ... |
@@ -304,8 +304,8 @@ func TestNetworkConfig(t *testing.T) {
|
| 304 | 304 |
//nolint:dupword // ignore "Duplicate words (network) found (dupword)" |
| 305 | 305 |
// Doing a partial match here omn the error-string here, as this produces either; |
| 306 | 306 |
// |
| 307 |
- // user specified configurations are not supported if the network depends on a configuration network |
|
| 308 |
- // network driver options are not supported if the network depends on a configuration network |
|
| 307 |
+ // - user-specified configurations are not supported if the network depends on a configuration network. |
|
| 308 |
+ // - network driver options are not supported if the network depends on a configuration network. |
|
| 309 | 309 |
// |
| 310 | 310 |
// We can consider changing this to a proper test-table. |
| 311 | 311 |
assert.Check(t, is.ErrorContains(err, `not supported if the network depends on a configuration network`)) |
| ... | ... |
@@ -415,7 +415,7 @@ func (n *Network) validateConfiguration() error {
|
| 415 | 415 |
!n.enableIPv4 || n.enableIPv6 || |
| 416 | 416 |
len(n.labels) > 0 || len(n.ipamOptions) > 0 || |
| 417 | 417 |
len(n.ipamV4Config) > 0 || len(n.ipamV6Config) > 0 {
|
| 418 |
- return types.ForbiddenErrorf("user specified configurations are not supported if the network depends on a configuration network")
|
|
| 418 |
+ return types.ForbiddenErrorf("user-specified configurations are not supported if the network depends on a configuration network")
|
|
| 419 | 419 |
} |
| 420 | 420 |
if len(n.generic) > 0 {
|
| 421 | 421 |
if data, ok := n.generic[netlabel.GenericData]; ok {
|
| ... | ... |
@@ -1319,7 +1319,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIP(c *testing.T) {
|
| 1319 | 1319 |
// Still it should fail to connect to the default network with a specified IP (whatever ip) |
| 1320 | 1320 |
out, _, err := dockerCmdWithError("network", "connect", "--ip", "172.21.55.44", "bridge", "c0")
|
| 1321 | 1321 |
assert.Assert(c, err != nil, "out: %s", out) |
| 1322 |
- assert.Assert(c, is.Contains(out, "user specified IP address is supported on user defined networks only")) |
|
| 1322 |
+ assert.Assert(c, is.Contains(out, "user-specified IP address is supported on user-defined networks only")) |
|
| 1323 | 1323 |
} |
| 1324 | 1324 |
|
| 1325 | 1325 |
func (s *DockerNetworkSuite) TestDockerNetworkConnectPreferredIPStoppedContainer(c *testing.T) {
|
| ... | ... |
@@ -1351,7 +1351,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1351 | 1351 |
checkUnsupportedNetworkAndIP(c, mode) |
| 1352 | 1352 |
} |
| 1353 | 1353 |
|
| 1354 |
- // requested IP is not supported on networks with no user defined subnets |
|
| 1354 |
+ // requested IP is not supported on networks with no user-defined subnets |
|
| 1355 | 1355 |
cli.DockerCmd(c, "network", "create", "n0") |
| 1356 | 1356 |
assertNwIsAvailable(c, "n0") |
| 1357 | 1357 |
|
| ... | ... |
@@ -1368,7 +1368,7 @@ func (s *DockerNetworkSuite) TestDockerNetworkUnsupportedRequiredIP(c *testing.T |
| 1368 | 1368 |
func checkUnsupportedNetworkAndIP(t *testing.T, nwMode string) {
|
| 1369 | 1369 |
out, _, err := dockerCmdWithError("run", "-d", "--net", nwMode, "--ip", "172.28.99.88", "--ip6", "2001:db8:1234::9988", "busybox", "top")
|
| 1370 | 1370 |
assert.Assert(t, err != nil, "out: %s", out) |
| 1371 |
- assert.Assert(t, is.Contains(out, "user specified IP address is supported on user defined networks only")) |
|
| 1371 |
+ assert.Assert(t, is.Contains(out, "user-specified IP address is supported on user-defined networks only")) |
|
| 1372 | 1372 |
} |
| 1373 | 1373 |
|
| 1374 | 1374 |
func verifyIPAddressConfig(t *testing.T, cName, nwname, ipv4, ipv6 string) {
|
| ... | ... |
@@ -3459,7 +3459,7 @@ func (s *DockerCLIRunSuite) TestContainerWithConflictingHostNetworks(c *testing. |
| 3459 | 3459 |
// Create a network using bridge driver |
| 3460 | 3460 |
cli.DockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| 3461 | 3461 |
|
| 3462 |
- // Connecting to the user defined network must fail |
|
| 3462 |
+ // Connecting to the user-defined network must fail |
|
| 3463 | 3463 |
_, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
|
| 3464 | 3464 |
assert.ErrorContains(c, err, "") |
| 3465 | 3465 |
} |
| ... | ... |
@@ -3475,7 +3475,7 @@ func (s *DockerCLIRunSuite) TestContainerWithConflictingSharedNetwork(c *testing |
| 3475 | 3475 |
// Create a network using bridge driver |
| 3476 | 3476 |
cli.DockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| 3477 | 3477 |
|
| 3478 |
- // Connecting to the user defined network must fail |
|
| 3478 |
+ // Connecting to the user-defined network must fail |
|
| 3479 | 3479 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "second")
|
| 3480 | 3480 |
assert.ErrorContains(c, err, "") |
| 3481 | 3481 |
assert.Assert(c, is.Contains(out, "container sharing network namespace with another container or host cannot be connected to any other network")) |
| ... | ... |
@@ -3489,7 +3489,7 @@ func (s *DockerCLIRunSuite) TestContainerWithConflictingNoneNetwork(c *testing.T |
| 3489 | 3489 |
// Create a network using bridge driver |
| 3490 | 3490 |
cli.DockerCmd(c, "network", "create", "-d", "bridge", "testnetwork1") |
| 3491 | 3491 |
|
| 3492 |
- // Connecting to the user defined network must fail |
|
| 3492 |
+ // Connecting to the user-defined network must fail |
|
| 3493 | 3493 |
out, _, err := dockerCmdWithError("network", "connect", "testnetwork1", "first")
|
| 3494 | 3494 |
assert.ErrorContains(c, err, "") |
| 3495 | 3495 |
assert.Assert(c, is.Contains(out, "container cannot be connected to multiple networks with one of the networks in private (none) mode")) |
| ... | ... |
@@ -82,7 +82,7 @@ func TestHostnameDnsResolution(t *testing.T) {
|
| 82 | 82 |
hostname = "foobar" |
| 83 | 83 |
) |
| 84 | 84 |
|
| 85 |
- // using user defined network as we want to use internal DNS |
|
| 85 |
+ // using user-defined network as we want to use internal DNS |
|
| 86 | 86 |
netName := "foobar-net" |
| 87 | 87 |
net.CreateNoError(ctx, t, apiClient, netName, net.WithDriver("bridge"))
|
| 88 | 88 |
|
| ... | ... |
@@ -280,7 +280,7 @@ func WithCgroupnsMode(mode string) func(*TestContainerConfig) {
|
| 280 | 280 |
} |
| 281 | 281 |
} |
| 282 | 282 |
|
| 283 |
-// WithExtraHost sets the user defined IP:Host mappings in the container's |
|
| 283 |
+// WithExtraHost sets the user-defined IP:Host mappings in the container's |
|
| 284 | 284 |
// /etc/hosts file |
| 285 | 285 |
func WithExtraHost(extraHost string) func(*TestContainerConfig) {
|
| 286 | 286 |
return func(c *TestContainerConfig) {
|
| ... | ... |
@@ -257,7 +257,7 @@ func testIpvlanL2MultiSubnet(t *testing.T, ctx context.Context, apiClient client |
| 257 | 257 |
) |
| 258 | 258 |
assert.Check(t, n.IsNetworkAvailable(ctx, apiClient, netName)) |
| 259 | 259 |
|
| 260 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 260 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 261 | 261 |
id1 := container.Run(ctx, t, apiClient, |
| 262 | 262 |
container.WithNetworkMode(netName), |
| 263 | 263 |
container.WithIPv4(netName, "172.28.200.20"), |
| ... | ... |
@@ -282,7 +282,7 @@ func testIpvlanL2MultiSubnet(t *testing.T, ctx context.Context, apiClient client |
| 282 | 282 |
_, err = container.Exec(ctx, apiClient, id2, []string{"ping6", "-c", "1", c1.Container.NetworkSettings.Networks[netName].GlobalIPv6Address.String()})
|
| 283 | 283 |
assert.NilError(t, err) |
| 284 | 284 |
|
| 285 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 285 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 286 | 286 |
id3 := container.Run(ctx, t, apiClient, |
| 287 | 287 |
container.WithNetworkMode(netName), |
| 288 | 288 |
container.WithIPv4(netName, "172.28.202.20"), |
| ... | ... |
@@ -327,7 +327,7 @@ func testIpvlanL3MultiSubnet(t *testing.T, ctx context.Context, apiClient client |
| 327 | 327 |
) |
| 328 | 328 |
assert.Check(t, n.IsNetworkAvailable(ctx, apiClient, netName)) |
| 329 | 329 |
|
| 330 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 330 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 331 | 331 |
id1 := container.Run(ctx, t, apiClient, |
| 332 | 332 |
container.WithNetworkMode(netName), |
| 333 | 333 |
container.WithIPv4(netName, "172.28.10.20"), |
| ... | ... |
@@ -348,7 +348,7 @@ func testIpvlanL3MultiSubnet(t *testing.T, ctx context.Context, apiClient client |
| 348 | 348 |
_, err = container.Exec(ctx, apiClient, id2, []string{"ping6", "-c", "1", c1.Container.NetworkSettings.Networks[netName].GlobalIPv6Address.String()})
|
| 349 | 349 |
assert.NilError(t, err) |
| 350 | 350 |
|
| 351 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 351 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 352 | 352 |
id3 := container.Run(ctx, t, apiClient, |
| 353 | 353 |
container.WithNetworkMode(netName), |
| 354 | 354 |
container.WithIPv4(netName, "172.28.12.20"), |
| ... | ... |
@@ -345,7 +345,7 @@ func testMacvlanMultiSubnet(t *testing.T, ctx context.Context, apiClient client. |
| 345 | 345 |
|
| 346 | 346 |
assert.Check(t, n.IsNetworkAvailable(ctx, apiClient, netName)) |
| 347 | 347 |
|
| 348 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 348 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.100.0/24 and 2001:db8:abc2::/64 |
|
| 349 | 349 |
id1 := container.Run(ctx, t, apiClient, |
| 350 | 350 |
container.WithNetworkMode("dualstackbridge"),
|
| 351 | 351 |
container.WithIPv4("dualstackbridge", "172.28.100.20"),
|
| ... | ... |
@@ -370,7 +370,7 @@ func testMacvlanMultiSubnet(t *testing.T, ctx context.Context, apiClient client. |
| 370 | 370 |
_, err = container.Exec(ctx, apiClient, id2, []string{"ping6", "-c", "1", c1.Container.NetworkSettings.Networks["dualstackbridge"].GlobalIPv6Address.String()})
|
| 371 | 371 |
assert.NilError(t, err) |
| 372 | 372 |
|
| 373 |
- // start dual stack containers and verify the user specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 373 |
+ // start dual stack containers and verify the user-specified --ip and --ip6 addresses on subnets 172.28.102.0/24 and 2001:db8:abc4::/64 |
|
| 374 | 374 |
id3 := container.Run(ctx, t, apiClient, |
| 375 | 375 |
container.WithNetworkMode("dualstackbridge"),
|
| 376 | 376 |
container.WithIPv4("dualstackbridge", "172.28.102.20"),
|
| ... | ... |
@@ -428,7 +428,7 @@ func testMacvlanAddressing(t *testing.T, ctx context.Context, client client.APIC |
| 428 | 428 |
assert.NilError(t, err) |
| 429 | 429 |
assert.Check(t, !strings.Contains(result.Combined(), "default via"), |
| 430 | 430 |
"result: %s", result.Combined()) |
| 431 |
- // Validate macvlan bridge mode sets the v6 gateway to the user specified default gateway/next-hop |
|
| 431 |
+ // Validate macvlan bridge mode sets the v6 gateway to the user-specified default gateway/next-hop |
|
| 432 | 432 |
result, err = container.Exec(ctx, client, id1, []string{"ip", "-6", "route"})
|
| 433 | 433 |
assert.NilError(t, err) |
| 434 | 434 |
assert.Check(t, is.Contains(result.Combined(), "default via 2001:db8:abca::254 dev eth0")) |
| ... | ... |
@@ -28,11 +28,11 @@ func TestNatNetworkICC(t *testing.T) {
|
| 28 | 28 |
netName string |
| 29 | 29 |
}{
|
| 30 | 30 |
{
|
| 31 |
- name: "Default nat network", |
|
| 31 |
+ name: "default nat network", |
|
| 32 | 32 |
netName: "nat", |
| 33 | 33 |
}, |
| 34 | 34 |
{
|
| 35 |
- name: "User defined nat network", |
|
| 35 |
+ name: "user-defined nat network", |
|
| 36 | 36 |
netName: "mynat", |
| 37 | 37 |
}, |
| 38 | 38 |
} |