Documentation
¶
Index ¶
- Constants
- Variables
- func EndReservedAddressed(cidr cnet.IPNet, r string) int
- func IP2Resutl(ip *cnet.IPNet, pool *v1alpha1.IPPool) *current.Result
- func StartReservedAddressed(cidr cnet.IPNet, r string) int
- type AutoAssignArgs
- type BlockUtilization
- type BrokenBlockUtilization
- type FixIpArgs
- type GetUtilizationArgs
- type IPAMClient
- func (c IPAMClient) AssignFixIps(handleID string, ipList, pools, blocks []string, info *PoolInfo, ...) (*current.Result, error)
- func (c IPAMClient) AutoAssign(args AutoAssignArgs) (*current.Result, error)
- func (c IPAMClient) AutoAssignFromBlocks(args AutoAssignArgs) (*current.Result, error)
- func (c IPAMClient) AutoAssignFromPools(args AutoAssignArgs) (*current.Result, error)
- func (c IPAMClient) AutoGenerateBlocksFromPool(poolName string) error
- func (c IPAMClient) DeleteBlock(b *v1alpha1.IPAMBlock) error
- func (c IPAMClient) FixIpsFromBlock(args FixIpArgs) (*current.Result, error)
- func (c IPAMClient) FixIpsFromPool(args FixIpArgs) (*current.Result, error)
- func (c IPAMClient) GetBrokenBlocks(args GetUtilizationArgs, missingHandles, mismatchHandles bool) ([]*PoolBlocksUtilization, error)
- func (c IPAMClient) GetHandleIDForIP(ip string) (handleID string, err error)
- func (c IPAMClient) GetIPByHandleID(handleID string) (ips []string, err error)
- func (c IPAMClient) GetPoolBlocksUtilization(args GetUtilizationArgs) ([]*PoolBlocksUtilization, error)
- func (c IPAMClient) GetUtilization(args GetUtilizationArgs) ([]*PoolUtilization, error)
- func (c IPAMClient) ListBlocks(pool string) ([]v1alpha1.IPAMBlock, error)
- func (c IPAMClient) ListInstancePods(instanceID string) (pods []*corev1.Pod, nodeName string, err error)
- func (c IPAMClient) RecordUsedIP(ip string, usedIPOption UsedIPOption, fix bool) error
- func (c IPAMClient) ReleaseByHandle(handleID string) error
- func (c IPAMClient) ReleaseIP(ip, blockName string) error
- func (c IPAMClient) ReleaseLeakIP(ip, blockName string, ingoreError bool) error
- func (c IPAMClient) Sync(stopCh <-chan struct{}) error
- type IPAllocatedInfo
- type Interface
- type LeakIPOption
- type PoolAccessorInterface
- type PoolBlocksUtilization
- type PoolInfo
- type PoolUtilization
- type UsedIPOption
Constants ¶
const ( // Common attributes which may be set on allocations by clients. IPAMBlockAttributePod = "pod" IPAMBlockAttributeNamespace = "namespace" IPAMBlockAttributeNode = "node" IPAMBlockAttributeIP = "ip" IPAMBlockAttributeTimestamp = "timestamp" )
Variables ¶
Functions ¶
Types ¶
type AutoAssignArgs ¶
type AutoAssignArgs struct { HandleID string // A key/value mapping of metadata to store with the allocations. Attrs map[string]string Pool string // extarnal Pools []string Blocks []string Info *PoolInfo }
AutoAssignArgs defines the set of arguments for assigning one or more IP addresses.
type BlockUtilization ¶
type BrokenBlockUtilization ¶ added in v1.0.8
type BrokenBlockUtilization struct { // This block's name. Name string IpToPods map[string][]string //key:ip value:podname list IpNotAllocExistsPod map[string]UsedIPOption //ip used by pod, but not record in ipamblock; key:ip value:podname;should check if handle exists IpAllocNotExistsPod map[string]string //have allocated in ipamblock but pod not exist; key:ip value:podname UsedHandlesMissing map[string]string //handle used in block, but handle resource not exists; key:ip value:handleID IpAllocRecordNotMatch map[string]IPAllocatedInfo //handle used in block, but record handleID not match, ip was used by other pod, not record one; key:ip value:handleID }
type FixIpArgs ¶
type FixIpArgs struct { AutoAssignArgs //annotation ips TarGetIpList []string }
FixIpArgs assign from config annotation
type GetUtilizationArgs ¶
type GetUtilizationArgs struct { // If specified, the pools whose utilization should be reported. Each string here // can be a pool name or CIDR. If not specified, this defaults to all pools. Pools []string }
GetUtilizationArgs defines the set of arguments for requesting IP utilization.
type IPAMClient ¶
type IPAMClient struct {
// contains filtered or unexported fields
}
IPAMClient implements Interface
func NewIPAMClient ¶
func NewIPAMClient(client versioned.Interface, typeStr string, informers informers.SharedInformerFactory, k8sInformers k8sinformers.SharedInformerFactory) IPAMClient
NewIPAMClient returns a new IPAMClient, which implements Interface.
func (IPAMClient) AssignFixIps ¶
func (c IPAMClient) AssignFixIps(handleID string, ipList, pools, blocks []string, info *PoolInfo, attrs map[string]string) (*current.Result, error)
AssignFixIps fix ip form assign pool or block
func (IPAMClient) AutoAssign ¶
func (c IPAMClient) AutoAssign(args AutoAssignArgs) (*current.Result, error)
AutoAssign automatically assigns one or more IP addresses as specified by the provided AutoAssignArgs. AutoAssign returns the list of the assigned IPv4 addresses, and the list of the assigned IPv6 addresses.
In case of error, returns the IPs allocated so far along with the error.
func (IPAMClient) AutoAssignFromBlocks ¶
func (c IPAMClient) AutoAssignFromBlocks(args AutoAssignArgs) (*current.Result, error)
func (IPAMClient) AutoAssignFromPools ¶
func (c IPAMClient) AutoAssignFromPools(args AutoAssignArgs) (*current.Result, error)
func (IPAMClient) AutoGenerateBlocksFromPool ¶
func (c IPAMClient) AutoGenerateBlocksFromPool(poolName string) error
func (IPAMClient) DeleteBlock ¶
func (c IPAMClient) DeleteBlock(b *v1alpha1.IPAMBlock) error
DeleteBlock deletes the given block.
func (IPAMClient) FixIpsFromBlock ¶
func (c IPAMClient) FixIpsFromBlock(args FixIpArgs) (*current.Result, error)
FixIpsFromBlock fix ip form assign block
func (IPAMClient) FixIpsFromPool ¶
func (c IPAMClient) FixIpsFromPool(args FixIpArgs) (*current.Result, error)
FixIpsFromPool fix ip from assign pool
func (IPAMClient) GetBrokenBlocks ¶ added in v1.0.16
func (c IPAMClient) GetBrokenBlocks(args GetUtilizationArgs, missingHandles, mismatchHandles bool) ([]*PoolBlocksUtilization, error)
func (IPAMClient) GetHandleIDForIP ¶ added in v1.0.16
func (c IPAMClient) GetHandleIDForIP(ip string) (handleID string, err error)
func (IPAMClient) GetIPByHandleID ¶ added in v1.0.15
func (c IPAMClient) GetIPByHandleID(handleID string) (ips []string, err error)
func (IPAMClient) GetPoolBlocksUtilization ¶
func (c IPAMClient) GetPoolBlocksUtilization(args GetUtilizationArgs) ([]*PoolBlocksUtilization, error)
func (IPAMClient) GetUtilization ¶
func (c IPAMClient) GetUtilization(args GetUtilizationArgs) ([]*PoolUtilization, error)
GetUtilization returns IP utilization info for the specified pools, or for all pools.
func (IPAMClient) ListBlocks ¶
func (c IPAMClient) ListBlocks(pool string) ([]v1alpha1.IPAMBlock, error)
func (IPAMClient) ListInstancePods ¶ added in v1.0.15
func (IPAMClient) RecordUsedIP ¶ added in v1.0.16
func (c IPAMClient) RecordUsedIP(ip string, usedIPOption UsedIPOption, fix bool) error
RecordUsedIP record used ip in ipamblock
func (IPAMClient) ReleaseByHandle ¶
func (c IPAMClient) ReleaseByHandle(handleID string) error
ReleaseByHandle releases all IP addresses that have been assigned using the provided handle.
func (IPAMClient) ReleaseIP ¶ added in v1.0.16
func (c IPAMClient) ReleaseIP(ip, blockName string) error
func (IPAMClient) ReleaseLeakIP ¶ added in v1.0.16
func (c IPAMClient) ReleaseLeakIP(ip, blockName string, ingoreError bool) error
release an allocated leaked ip in ipamblock; param ip required; if ip was used by existing pod, return error and do nothing if give blockName, should check if the ip belongs to the block if not give blockName, should check all blocks in the pool to get which block the ip belongs to
func (IPAMClient) Sync ¶ added in v1.0.4
func (c IPAMClient) Sync(stopCh <-chan struct{}) error
type IPAllocatedInfo ¶ added in v1.0.16
type IPAllocatedInfo struct { RecordHandleID string CurrentUsedPod UsedIPOption }
type Interface ¶
type Interface interface { // AutoAssign automatically assigns one or more IP addresses as specified by the // provided AutoAssignArgs. AutoAssign returns the list of the assigned IPv4 addresses, // and the list of the assigned IPv6 addresses in IPNet format. // The returned IPNet represents the allocation block from which the IP was allocated, // which is useful for dataplanes that need to know the subnet (such as Windows). // // In case of error, returns the IPs allocated so far along with the error. AutoAssign(args AutoAssignArgs) (*current.Result, error) AutoAssignFromPools(args AutoAssignArgs) (*current.Result, error) AutoAssignFromBlocks(args AutoAssignArgs) (*current.Result, error) AutoGenerateBlocksFromPool(pool string) error // ReleaseByHandle releases all IP addresses that have been assigned // using the provided handle. Returns an error if no addresses // are assigned with the given handle. ReleaseByHandle(handleID string) error GetUtilization(args GetUtilizationArgs) ([]*PoolUtilization, error) GetPoolBlocksUtilization(args GetUtilizationArgs) ([]*PoolBlocksUtilization, error) }
ipam.Interface has methods to perform IP address management.
type LeakIPOption ¶ added in v1.0.16
type LeakIPOption struct { }
type PoolAccessorInterface ¶
type PoolAccessorInterface interface {
// contains filtered or unexported methods
}
Interface used to access the enabled IPPools.
type PoolBlocksUtilization ¶
type PoolBlocksUtilization struct { // This pool's name. Name string // Number of possible IPs in this block. Capacity int // Number of available IPs in this block. Unallocated int Allocate int Reserved int // This blocks' util which belong to pool. Blocks []*BlockUtilization // This blocks' util which belong to pool. BrokenBlocks []*BrokenBlockUtilization BrokenBlockNames []string BrokenBlockFixSucceed []string }