Skip to content

Give LB sandboxes predictable names#2240

Merged
fcrisciani merged 1 commit intomoby:masterfrom
ctelfer:nice-lb-names
Jul 25, 2018
Merged

Give LB sandboxes predictable names#2240
fcrisciani merged 1 commit intomoby:masterfrom
ctelfer:nice-lb-names

Conversation

@ctelfer
Copy link
Contributor

@ctelfer ctelfer commented Jul 24, 2018

Change the sandbox IDs for the sandboxes of load-balancing endpoints to be "lb_XXXXXXXXX" where XXXXXXXXX is the first 9 characters of the network ID that this sandbox load balances for. This makes it easier to find these sandboxes in /var/run/docker/netns and thus makes debugging easier.

Signed-off-by: Chris Telfer [email protected]

sb.config.resolvConfPath = filepath.Join(c.cfg.Daemon.DataDir, "/network/files/resolv.conf")
sb.id = "ingress_sbox"
} else if sb.loadBalancerNID != "" {
sb.id = "lb_" + sb.loadBalancerNID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do lb-<id> so that is consistent with the 1- of the overlay?

Copy link
Contributor Author

@ctelfer ctelfer Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, not easily. The network namespaces in /var/run/docker/netns of the form 1-XXXXXXXXX are generated within the overlay driver and don't have actual libnetwork.Sandbox structures associated with them. The load balancer sandboxes, by contrast, are full blown libnetwork.Sandbox entities. I tried naming them lb-XXXXXXXXX first, actually, but doing so caused immediate failures. I am not sure why yet. But just changing "-" to "_" completely fixed the issue. I could change the form to be XXXXXXX_sbox perhaps if that seems preferable. WDYT?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still like more the lb prefix, it's much more explainable than the _sbox postfix

ingress bool
ndotsSet bool
oslTypes []osl.SandboxType // slice of properties of this sandbox
loadBalancerNID string // NID that this SB is a load balancer for

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this actually the network id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the network ID of the network that this sandbox load balances for. Of course, this is only set if the sandbox is specifically a load balancer sandbox. Otherwise a given sandbox is most likely a container and can belong to multiple networks.

Change the sandbox IDs for the sandboxes of load-balancing endpoints to
be "lb_XXXXXXXXX" where XXXXXXXXX is the network ID that this sandbox
load balances for.  This makes it easier to find these sandboxes in
/var/run/docker/netns and thus makes debugging easier.

Signed-off-by: Chris Telfer <[email protected]>
@ctelfer
Copy link
Contributor Author

ctelfer commented Jul 25, 2018

Not sure where this error is coming from

=== RUN   TestValidRemoteDriver
ERRO[0037] error getting capability for valid-network-driver due to NetworkDriver.GetCapabilities: 404 page not found

but I'm certain that the change doesn't touch the remote drivers in any way.

@fcrisciani
Copy link

@ctelfer the actual failure is the following:

--- FAIL: TestNetworkDBIslands (75.91s)
	networkdb_test.go:837: assertion failed: expected map[dc60b442612e:dc60b442612e 8f9880016771:8f9880016771] (length 2) to have length 3
	networkdb_test.go:838: assertion failed: expected map[d51614e64cbd:d51614e64cbd] (length 1) to have length 0

The one that you mention is just an error log but the test passes.
I restarted the unit test step, should go green

Copy link

@fcrisciani fcrisciani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fcrisciani fcrisciani merged commit f30a35b into moby:master Jul 25, 2018
@ctelfer ctelfer deleted the nice-lb-names branch July 27, 2018 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants