Documentation ¶
Index ¶
- Constants
- func Init(ctx context.Context, sess *session.Session, source extraconfig.DataSource, ...) error
- func ScopedAliasName(scope string, container string, alias string) string
- type AddContainerOptions
- type AddressSpace
- func (s *AddressSpace) Defragment() error
- func (s *AddressSpace) Equal(other *AddressSpace) bool
- func (s *AddressSpace) NextIP4Net(mask net.IPMask) (*net.IPNet, error)
- func (s *AddressSpace) ReleaseIP4(ip net.IP) error
- func (s *AddressSpace) ReleaseIP4Range(space *AddressSpace) error
- func (s *AddressSpace) ReserveIP4(ip net.IP) error
- func (s *AddressSpace) ReserveIP4Net(ipNet *net.IPNet) (*AddressSpace, error)
- func (s *AddressSpace) ReserveIP4Range(firstIP net.IP, lastIP net.IP) (*AddressSpace, error)
- func (s *AddressSpace) ReserveNextIP4() (net.IP, error)
- func (s *AddressSpace) ReserveNextIP4Net(mask net.IPMask) (*AddressSpace, error)
- type Configuration
- type Container
- type Context
- func (c *Context) AddContainer(h *exec.Handle, options *AddContainerOptions) error
- func (c *Context) BindContainer(op trace.Operation, h *exec.Handle) ([]*Endpoint, error)
- func (c *Context) Container(key string) *Container
- func (c *Context) ContainerByAddr(addr net.IP) *Endpoint
- func (c *Context) ContainersByAlias(alias string) []*Container
- func (c *Context) DefaultScope() *Scope
- func (c *Context) DeleteScope(ctx context.Context, name string) error
- func (c *Context) NewScope(ctx context.Context, scopeData *ScopeData) (*Scope, error)
- func (c *Context) RemoveContainer(h *exec.Handle, scope string) error
- func (c *Context) RemoveIDFromScopes(op trace.Operation, id string) ([]*Endpoint, error)
- func (c *Context) Scopes(ctx context.Context, idName *string) ([]*Scope, error)
- func (c *Context) UnbindContainer(op trace.Operation, h *exec.Handle) ([]*Endpoint, error)
- type DuplicateResourceError
- type Endpoint
- type Link
- type LinkAttrs
- type Port
- type ResourceNotFoundError
- type Scope
- func (s *Scope) AddContainer(con *Container, e *Endpoint) error
- func (s *Scope) Annotations() map[string]string
- func (s *Scope) Container(id uid.UID) *Container
- func (s *Scope) ContainerByAddr(addr net.IP) *Endpoint
- func (s *Scope) Containers() []*Container
- func (s *Scope) DNS() []net.IP
- func (s *Scope) Endpoints() []*Endpoint
- func (s *Scope) Gateway() net.IP
- func (s *Scope) ID() uid.UID
- func (s *Scope) Internal() bool
- func (s *Scope) MarshalJSON() ([]byte, error)
- func (s *Scope) Name() string
- func (s *Scope) Network() object.NetworkReference
- func (s *Scope) Pools() []*ip.Range
- func (s *Scope) RemoveContainer(con *Container) error
- func (s *Scope) Subnet() *net.IPNet
- func (s *Scope) TrustLevel() executor.TrustLevel
- func (s *Scope) Type() string
- func (s *Scope) UnmarshalJSON(data []byte) error
- type ScopeData
Constants ¶
const (
DefaultBridgeName = "bridge"
)
const NilPort = Port("")
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(ctx context.Context, sess *session.Session, source extraconfig.DataSource, sink extraconfig.DataSink) error
Types ¶
type AddContainerOptions ¶
type AddressSpace ¶
type AddressSpace struct { Parent *AddressSpace Network *net.IPNet Pool *ip.Range // contains filtered or unexported fields }
An AddressSpace is a collection of IP address ranges
func NewAddressSpaceFromNetwork ¶
func NewAddressSpaceFromNetwork(ipRange *net.IPNet) *AddressSpace
NewAddressSpaceFromNetwork creates a new AddressSpace from a network specification.
func NewAddressSpaceFromRange ¶
func NewAddressSpaceFromRange(firstIP net.IP, lastIP net.IP) *AddressSpace
NewAddressSpaceFromRange creates a new AddressSpace from a range of IP addresses.
func (*AddressSpace) Defragment ¶
func (s *AddressSpace) Defragment() error
func (*AddressSpace) Equal ¶
func (s *AddressSpace) Equal(other *AddressSpace) bool
Equal compares two address spaces for equality.
func (*AddressSpace) NextIP4Net ¶
func (*AddressSpace) ReleaseIP4 ¶
func (s *AddressSpace) ReleaseIP4(ip net.IP) error
ReleaseIP4 releases the given IPv4 address.
func (*AddressSpace) ReleaseIP4Range ¶
func (s *AddressSpace) ReleaseIP4Range(space *AddressSpace) error
ReleaseIP4Range releases a sub address space into the parent address space. Sub address space has to have only a single available range.
func (*AddressSpace) ReserveIP4 ¶
func (s *AddressSpace) ReserveIP4(ip net.IP) error
ReserveIP4 reserves the given IPv4 address.
func (*AddressSpace) ReserveIP4Net ¶
func (s *AddressSpace) ReserveIP4Net(ipNet *net.IPNet) (*AddressSpace, error)
ReserveIP4Net reserves a new sub address space given an IP and mask. Mask is required. If IP is nil or "0.0.0.0", same as calling ReserveNextIP4Net with the mask.
func (*AddressSpace) ReserveIP4Range ¶
func (s *AddressSpace) ReserveIP4Range(firstIP net.IP, lastIP net.IP) (*AddressSpace, error)
ReserveIP4Range reserves a sub address space given a first and last IP.
func (*AddressSpace) ReserveNextIP4 ¶
func (s *AddressSpace) ReserveNextIP4() (net.IP, error)
ReserveNextIP4 reserves the next available IPv4 address.
func (*AddressSpace) ReserveNextIP4Net ¶
func (s *AddressSpace) ReserveNextIP4Net(mask net.IPMask) (*AddressSpace, error)
ReserveNextIP4Net reserves a new sub address space within the given address space, given a bitmask specifying the "width" of the requested space.
type Configuration ¶
type Configuration struct { // Turn on debug logging DebugLevel int `vic:"0.1" scope:"read-only" key:"init/diagnostics/debug"` // Port Layer - network config.Network `vic:"0.1" scope:"read-only" key:"network"` // The bridge link BridgeLink Link `vic:"0.1" scope:"read-only" recurse:"depth=0"` // the vsphere portgroups corresponding to container network configuration PortGroups map[string]object.NetworkReference `vic:"0.1" scope:"read-only" recurse:"depth=0"` // contains filtered or unexported fields }
func (*Configuration) Decode ¶
func (c *Configuration) Decode()
func (*Configuration) Encode ¶
func (c *Configuration) Encode()
type Context ¶
Context denotes a network context that represents a set of scopes, endpoints, and containers. Each context has its own separate IPAM.
var (
DefaultContext *Context
)
func NewContext ¶
func NewContext(config *Configuration, kv kvstore.KeyValueStore) (*Context, error)
func (*Context) AddContainer ¶
func (c *Context) AddContainer(h *exec.Handle, options *AddContainerOptions) error
AddContainer add a container to the specified scope, optionally specifying an ip address for the container in the scope
func (*Context) BindContainer ¶
func (*Context) ContainersByAlias ¶
func (*Context) DefaultScope ¶
func (*Context) RemoveContainer ¶
func (*Context) RemoveIDFromScopes ¶
RemoveIDFromScopes removes the container from the scopes but doesn't touch the runtime state Because of that it requires an id
type DuplicateResourceError ¶
type DuplicateResourceError struct {
// contains filtered or unexported fields
}
func (DuplicateResourceError) Error ¶
func (e DuplicateResourceError) Error() string
type Port ¶
type Port string
func PortFromMapping ¶
func PortFromMapping(mapping nat.PortMapping) Port
PortFromMapping constructs the full form of a port mapping This has been added to help migrate towards consistent data returns for Endpoint structures
func (Port) FullString ¶
type ResourceNotFoundError ¶
type ResourceNotFoundError struct {
// contains filtered or unexported fields
}
type Scope ¶
func (*Scope) Annotations ¶
func (*Scope) Containers ¶
func (*Scope) MarshalJSON ¶
func (*Scope) Network ¶
func (s *Scope) Network() object.NetworkReference
func (*Scope) RemoveContainer ¶
func (*Scope) TrustLevel ¶
func (s *Scope) TrustLevel() executor.TrustLevel