Documentation
¶
Overview ¶
Package dockernet carves Docker bridge networks out of an address range of Pando's own rather than Docker's default pool, which holds about thirty networks (issue #55). The Docker runtime adapter makes app networks with it, and the BuildKit builder each app's build network.
It imports nothing from core.
Index ¶
- Constants
- func BlockTaken(err error) bool
- func Create(ctx context.Context, cli API, name string, pool netip.Prefix, bits int, ...) (client.NetworkCreateResult, error)
- func FreeBlocks(pool netip.Prefix, bits int, used []netip.Prefix) func(func(netip.Prefix) bool)
- func UsedSubnets(ctx context.Context, cli API) ([]netip.Prefix, error)
- type API
Constants ¶
const DefaultPool = "10.213.0.0/16"
DefaultPool is the range Pando's networks take their addresses from when none is set: app networks (/28s) and build networks (/29s) alike, kept apart by the overlap check in Create. An unusual corner of private space; an install whose own LAN uses it sets another.
Variables ¶
This section is empty.
Functions ¶
func BlockTaken ¶
BlockTaken reports a refusal that means only "that block is in use", which is a reason to try the next one rather than to fail.
In the engine's words, because nothing else says which refusal it was. Docker answers "Pool overlaps with other one on this address space". Podman checks the host's routes as well as its own networks and answers "subnet … is already used on the host or by another config" — and a block another engine on the same machine holds is exactly what it finds there. Reading only Docker's wording failed every deploy on such a Podman at the first taken block.
func Create ¶
func Create(ctx context.Context, cli API, name string, pool netip.Prefix, bits int, opts client.NetworkCreateOptions) (client.NetworkCreateResult, error)
Create creates a bridge network with an address block of bits from pool, falling back to Docker's own allocation when the network list cannot be read or every block tried was refused.
The caller serializes calls that share a pool: two creates choosing at once would both see the same free block. Docker still has the last word — a block taken by something outside the process is refused as overlapping — so a refusal moves on to the next block rather than failing.
func FreeBlocks ¶
FreeBlocks yields the pool's blocks of the given size that overlap nothing in use, in order. Blocks of different sizes share the pool: each is aligned to its own size, so the overlap check is all that keeps them apart.
Types ¶
type API ¶
type API interface {
NetworkList(ctx context.Context, opts client.NetworkListOptions) (client.NetworkListResult, error)
NetworkCreate(ctx context.Context, name string, opts client.NetworkCreateOptions) (client.NetworkCreateResult, error)
}
API is the part of the Docker client a network is made with.