ipam

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ipam provides options for IP address management (“IPAM”), making Docker's IPAM-related API data structures more accessible.

Usage

The IPAM configuration options can be used in the context of creating a new custom Docker network as follows:

morbyd.NewNetwork(ctx, "my-custom-notwork",
    net.WithIPAM(ipam.WithPool("0.0.1.0/24", ipam.WithRange("0.0.1.16/28"))),
)

Please note using github.com/thediveo/morbyd/net.WithIPAM for configuring an IPAM driver, including setting up multiple address pools by way of WithPool.

References

For further background information on Docker IPAMs, please see:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAM

type IPAM network.IPAM

IPAM represents Docker's IPAM driver options, including IP address pool configuration, for creating a new custom Docker network.

type IPAMOpt

type IPAMOpt func(*IPAM) error

IPAMOpt is a configuration option for configuring an IPAM driver (or “IPAM” for short).

func WithName

func WithName(name string) IPAMOpt

WithName sets the name of the IPAM driver to use. When unset, it defaults to “default” (sic!), see also DefaultIPAM driver name in the Moby libnetwork codebase.

Please note that the “null” IPAM driver cannot be used with at least some of the network drivers, as these explicitly reject any attempt to use the “null” IPAM in order to not automatically assign any container IP addresses. A prominent example is the “macvlan” network driver.

func WithOption

func WithOption(option string) IPAMOpt

WithOption specifies a IPAM driver-specific option in “KEY=VALUE” format.

func WithPool

func WithPool(subnet string, opts ...PoolOpt) IPAMOpt

WithPool adds an IP address pool for the specified subnet, and accepting further pool configuration options (see PoolOpt).

type Pool

type Pool network.IPAMConfig

Pool represents an IP address pool, consisting of an IP subnet, and optionally an IP range inside the subnet to hand out addresses from, an optional default router IP address, and optional blocked (auxiliary) IP addresses.

type PoolOpt

type PoolOpt func(*Pool) error

PoolOpt is a configuration option for an IP address pool.

func WithAuxAddress

func WithAuxAddress(hostname string, ip string) PoolOpt

WithAuxAddress informs the IPAM driver of an IP address already in use in the network, so the driver must not allocate it to a container. In addition, this auxiliary IP address is assigned the specified hostname.

func WithGateway

func WithGateway(gw string) PoolOpt

WithGateway specifies the default router's (“gateway” in IPv4 parlance) IP address.

func WithRange

func WithRange(iprange string) PoolOpt

WithRange specifies a (sub) range of IP addresses within the Pool's subnet to allocate the addresses from (instead of allocating from the whole subnet range by default).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL