Documentation ¶
Index ¶
- Constants
- func GetSubnetIDFromNodeLabels(labels map[string]string) string
- type IPPool
- type InstancesManager
- func (m *InstancesManager) CreateNetResource(obj *v2.NetResourceSet, node *ipam.NetResource) ipam.NetResourceOperations
- func (m *InstancesManager) GetIPPool() *IPPool
- func (m *InstancesManager) GetPodPool() *IPPool
- func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap
- func (m *InstancesManager) GetSubnet(id string) *api2.Subnet
- func (m *InstancesManager) NodeEndpoint(cep *ccev2.CCEEndpoint) (endpoint.DirectEndpointOperation, error)
- func (m *InstancesManager) Resync(ctx context.Context) time.Time
- func (m *InstancesManager) ResyncFixedIPs(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)
- func (*InstancesManager) ResyncPool(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)
- type Node
- func (n *Node) AllocateIPs(ctx context.Context, allocation *ipam.AllocationAction) error
- func (n *Node) CreateInterface(ctx context.Context, allocation *ipam.AllocationAction, ...) (int, string, error)
- func (n *Node) GetMaximumAllocatableIPv4() int
- func (n *Node) GetMaximumBurstableAllocatableIPv4() int
- func (n *Node) GetMinimumAllocatableIPv4() int
- func (n *Node) GetUsedIPWithPrefixes() int
- func (n *Node) IsPrefixDelegated() bool
- func (n *Node) PopulateStatusFields(resource *v2.NetResourceSet)
- func (n *Node) PrepareIPAllocation(scopedLog *logrus.Entry) (a *ipam.AllocationAction, err error)
- func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *logrus.Entry) *ipam.ReleaseAction
- func (n *Node) ReleaseIPs(ctx context.Context, release *ipam.ReleaseAction) error
- func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (ipamTypes.AllocationMap, error)
- func (n *Node) UpdatedNode(obj *v2.NetResourceSet)
Constants ¶
const ( // LabelPrivateCloudBaseTopologySwitchName Private cloud base switch name LabelPrivateCloudBaseTopologySwitchName = "topology.kubernetes.io/subnet" // PrivateCloudBaseName type name of baidu base private cloud PrivateCloudBaseName = "PrivateCloudBase" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IPPool ¶
type IPPool struct {
// contains filtered or unexported fields
}
func (*IPPool) AddIP ¶
func (pool *IPPool) AddIP(ip *api2.AllocatedIP)
func (*IPPool) DeleteByIP ¶
func (*IPPool) DeleteIP ¶
func (pool *IPPool) DeleteIP(ip *api2.AllocatedIP)
func (*IPPool) GetIPByOwner ¶
func (pool *IPPool) GetIPByOwner(subnet, id string) []*api2.AllocatedIP
GetIPByOwner Owner has two values
1. Node's available IP cache pool node/{nodeName}/{uid}
2. Fixed IP pod pod/{namespace}/{name}
type InstancesManager ¶
type InstancesManager struct { // status of Private Cloud Base // index by subnetID and ip IPPool *IPPool // contains filtered or unexported fields }
InstancesManager maintains the list of instances. It must be kept up to date by calling resync() regularly.
func NewInstancesManager ¶
func NewInstancesManager(api api2.Client, getterUpdater ipam.NetResourceSetGetterUpdater) *InstancesManager
NewInstancesManager returns a new instances manager
func (*InstancesManager) CreateNetResource ¶
func (m *InstancesManager) CreateNetResource(obj *v2.NetResourceSet, node *ipam.NetResource) ipam.NetResourceOperations
CreateNetResource is called when the IPAM layer has learned about a new node which requires IPAM services. This function must return a NodeOperations implementation which will render IPAM services to the node context provided.
func (*InstancesManager) GetIPPool ¶
func (m *InstancesManager) GetIPPool() *IPPool
func (*InstancesManager) GetPodPool ¶
func (m *InstancesManager) GetPodPool() *IPPool
func (*InstancesManager) GetPoolQuota ¶
func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap
GetPoolQuota returns the number of available IPs in all IP pools
func (*InstancesManager) NodeEndpoint ¶
func (m *InstancesManager) NodeEndpoint(cep *ccev2.CCEEndpoint) (endpoint.DirectEndpointOperation, error)
NodeEndpoint implements endpoint.DirectIPAllocator
func (*InstancesManager) Resync ¶
func (m *InstancesManager) Resync(ctx context.Context) time.Time
Resync is called periodically to give the IPAM implementation a chance to resync its own state with external APIs or systems. It is also called when the IPAM layer detects that state got out of sync.
func (*InstancesManager) ResyncFixedIPs ¶
func (m *InstancesManager) ResyncFixedIPs(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)
func (*InstancesManager) ResyncPool ¶
func (*InstancesManager) ResyncPool(ctx context.Context, scopedLog *logrus.Entry) (map[string]ipamTypes.AllocationMap, error)
ResyncPool implements endpoint.DirectIPAllocator
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a Kubernetes node running CCE with an associated NetResourceSet custom resource
func NewNode ¶
func NewNode(node *ipam.NetResource, k8sObj *v2.NetResourceSet, manager *InstancesManager) *Node
NewNode returns a new Node
func (*Node) AllocateIPs ¶
func (*Node) CreateInterface ¶
func (*Node) GetMaximumAllocatableIPv4 ¶
func (*Node) GetMaximumBurstableAllocatableIPv4 ¶
func (*Node) GetMinimumAllocatableIPv4 ¶
func (*Node) GetUsedIPWithPrefixes ¶
func (*Node) IsPrefixDelegated ¶
func (*Node) PopulateStatusFields ¶
func (n *Node) PopulateStatusFields(resource *v2.NetResourceSet)
func (*Node) PrepareIPAllocation ¶
func (*Node) PrepareIPRelease ¶
func (*Node) ReleaseIPs ¶
func (*Node) ResyncInterfacesAndIPs ¶
func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (ipamTypes.AllocationMap, error)
ResyncInterfacesAndIPs is called to synchronize the latest list of interfaces and IPs associated with the node. This function is called sparingly as this information is kept in sync based on the success of the functions AllocateIPs(), ReleaseIPs() and CreateInterface().
func (*Node) UpdatedNode ¶
func (n *Node) UpdatedNode(obj *v2.NetResourceSet)