manager

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManager

func NewManager(networks []string, nGetter NetworkGetter, sGetter SubnetGetter, iGetter IPSetGetter) (ipam.Manager, error)

NewManager is a kind of constructor of ipam.Manager

Types

type IPSetGetter

type IPSetGetter func(subnet string) (types.IPSet, error)

type Manager

type Manager struct {
	sync.RWMutex

	NetworkSet types.NetworkSet

	NetworkGetter NetworkGetter
	SubnetGetter  SubnetGetter
	IPSetGetter   IPSetGetter
}

Manager is the build-in IPAM Manager implementation

func (*Manager) Allocate

func (m *Manager) Allocate(networkName string, podInfo types.PodInfo, opts ...types.AllocateOption) (allocatedIPs []*types.IP, err error)

Allocate will allocate some new IP for a specified pod

func (*Manager) Assign

func (m *Manager) Assign(networkName string, podInfo types.PodInfo, assignedSuites []types.SubnetIPSuite, opts ...types.AssignOption) (assignedIPs []*types.IP, err error)

Assign will recouple a specified pod with some allocated IPs

func (*Manager) GetNetworkUsage

func (m *Manager) GetNetworkUsage(networkName string) (*types.NetworkUsage, error)

GetNetworkUsage will return a network usage statistics including different ip family and all subnets

func (*Manager) GetSubnetUsage

func (m *Manager) GetSubnetUsage(networkName, subnetName string) (*types.Usage, error)

GetSubnetUsage will return a usage statistics of a specified subnet of a network

func (*Manager) Refresh

func (m *Manager) Refresh(opts ...types.RefreshOption) error

Refresh will trigger network data update in cache

func (*Manager) Release

func (m *Manager) Release(networkName string, releaseSuites []types.SubnetIPSuite) (err error)

Release will release some IPs from allocation or assignment to a specified pod

func (*Manager) Reserve

func (m *Manager) Reserve(networkName string, reserveSuites []types.SubnetIPSuite) (err error)

Reserve will reserve some IPs from a binding pod

type NetworkGetter

type NetworkGetter func(network string) (*types.Network, error)

type SubnetGetter

type SubnetGetter func(network string) ([]*types.Subnet, error)

Jump to

Keyboard shortcuts

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