Documentation ¶
Index ¶
- type AlibabaCloudAPI
- type InstancesManager
- func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, node *ipam.Node) ipam.NodeOperations
- func (m *InstancesManager) DeleteInstance(instanceID string)
- func (m *InstancesManager) FindOneVSwitch(spec eniTypes.Spec, toAllocate int) *ipamTypes.Subnet
- func (m *InstancesManager) FindSecurityGroupByTags(vpcID string, required ipamTypes.Tags) []*types.SecurityGroup
- func (m *InstancesManager) FindVSwitchByIDs(spec eniTypes.Spec, toAllocate int) *ipamTypes.Subnet
- func (m *InstancesManager) ForeachInstance(instanceID string, fn ipamTypes.InterfaceIterator)
- func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap
- func (m *InstancesManager) GetVSwitch(id string) *ipamTypes.Subnet
- func (m *InstancesManager) GetVSwitches() ipamTypes.SubnetMap
- func (m *InstancesManager) HasInstance(instanceID string) bool
- func (m *InstancesManager) Resync(ctx context.Context) time.Time
- func (m *InstancesManager) UpdateENI(instanceID string, eni *eniTypes.ENI)
- type Node
- func (n *Node) AllocateIPs(ctx context.Context, a *ipam.AllocationAction) error
- func (n *Node) CreateInterface(ctx context.Context, allocation *ipam.AllocationAction, ...) (int, string, error)
- func (n *Node) GetMaximumAllocatableIPv4() int
- func (n *Node) GetMinimumAllocatableIPv4() int
- func (n *Node) GetUsedIPWithPrefixes() int
- func (n *Node) IsPrefixDelegated() bool
- func (n *Node) PopulateStatusFields(resource *v2.CiliumNode)
- func (n *Node) PrepareIPAllocation(scopedLog *logrus.Entry) (*ipam.AllocationAction, error)
- func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *logrus.Entry) *ipam.ReleaseAction
- func (n *Node) ReleaseIPs(ctx context.Context, r *ipam.ReleaseAction) error
- func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (available ipamTypes.AllocationMap, remainAvailableENIsCount int, err error)
- func (n *Node) UpdatedNode(obj *v2.CiliumNode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlibabaCloudAPI ¶
type AlibabaCloudAPI interface { GetInstances(ctx context.Context, vpcs ipamTypes.VirtualNetworkMap, subnets ipamTypes.SubnetMap) (*ipamTypes.InstanceMap, error) GetVSwitches(ctx context.Context) (ipamTypes.SubnetMap, error) GetVPC(ctx context.Context, vpcID string) (*ipamTypes.VirtualNetwork, error) GetVPCs(ctx context.Context) (ipamTypes.VirtualNetworkMap, error) GetSecurityGroups(ctx context.Context) (types.SecurityGroupMap, error) CreateNetworkInterface(ctx context.Context, secondaryPrivateIPCount int, vSwitchID string, groups []string, tags map[string]string) (string, *eniTypes.ENI, error) AttachNetworkInterface(ctx context.Context, instanceID, eniID string) error WaitENIAttached(ctx context.Context, eniID string) (string, error) DeleteNetworkInterface(ctx context.Context, eniID string) error AssignPrivateIPAddresses(ctx context.Context, eniID string, toAllocate int) ([]string, error) UnassignPrivateIPAddresses(ctx context.Context, eniID string, addresses []string) error }
AlibabaCloudAPI is the API surface used of the ECS API
type InstancesManager ¶
type InstancesManager struct {
// 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 AlibabaCloudAPI) *InstancesManager
NewInstancesManager returns a new instances manager
func (*InstancesManager) CreateNode ¶
func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, node *ipam.Node) ipam.NodeOperations
CreateNode
func (*InstancesManager) DeleteInstance ¶
func (m *InstancesManager) DeleteInstance(instanceID string)
DeleteInstance delete instance from m.instances
func (*InstancesManager) FindOneVSwitch ¶
FindOneVSwitch returns the vSwitch with the fewest available addresses, matching vpc and az. If we have explicit ID or tag constraints, chose a matching vSwitch. ID constraints take precedence.
func (*InstancesManager) FindSecurityGroupByTags ¶
func (m *InstancesManager) FindSecurityGroupByTags(vpcID string, required ipamTypes.Tags) []*types.SecurityGroup
FindSecurityGroupByTags returns the security groups matching VPC ID and all required tags The returned security groups slice is immutable so it can be safely accessed
func (*InstancesManager) FindVSwitchByIDs ¶
FindVSwitchByIDs returns the vSwitch within a provided list of vSwitch IDs with the fewest available addresses, matching vpc and az.
func (*InstancesManager) ForeachInstance ¶
func (m *InstancesManager) ForeachInstance(instanceID string, fn ipamTypes.InterfaceIterator)
ForeachInstance will iterate over each instance inside `instances`, and call `fn`. This function is read-locked for the entire execution.
func (*InstancesManager) GetPoolQuota ¶
func (m *InstancesManager) GetPoolQuota() ipamTypes.PoolQuotaMap
GetPoolQuota returns the number of available IPs in all IP pools
func (*InstancesManager) GetVSwitch ¶
func (m *InstancesManager) GetVSwitch(id string) *ipamTypes.Subnet
GetVSwitch return vSwitch by id
func (*InstancesManager) GetVSwitches ¶
func (m *InstancesManager) GetVSwitches() ipamTypes.SubnetMap
GetVSwitches returns all the tracked vSwitches The returned subnetMap is immutable so it can be safely accessed
func (*InstancesManager) HasInstance ¶
func (m *InstancesManager) HasInstance(instanceID string) bool
HasInstance returns whether the instance is in instances
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AllocateIPs ¶
AllocateIPs performs the ENI allocation operation
func (*Node) CreateInterface ¶
func (n *Node) CreateInterface(ctx context.Context, allocation *ipam.AllocationAction, scopedLog *logrus.Entry) (int, string, error)
CreateInterface creates an additional interface with the instance and attaches it to the instance as specified by the CiliumNode. neededAddresses of secondary IPs are assigned to the interface up to the maximum number of addresses as allowed by the instance.
func (*Node) GetMaximumAllocatableIPv4 ¶
GetMaximumAllocatableIPv4 returns the maximum amount of IPv4 addresses that can be allocated to the instance
func (*Node) GetMinimumAllocatableIPv4 ¶
GetMinimumAllocatableIPv4 returns the minimum amount of IPv4 addresses that must be allocated to the instance.
func (*Node) GetUsedIPWithPrefixes ¶
func (*Node) IsPrefixDelegated ¶
func (*Node) PopulateStatusFields ¶
func (n *Node) PopulateStatusFields(resource *v2.CiliumNode)
PopulateStatusFields fills in the status field of the CiliumNode custom resource with ENI specific information
func (*Node) PrepareIPAllocation ¶
PrepareIPAllocation returns the number of ENI IPs and interfaces that can be allocated/created.
func (*Node) PrepareIPRelease ¶
PrepareIPRelease prepares the release of ENI IPs.
func (*Node) ReleaseIPs ¶
ReleaseIPs performs the ENI IP release operation
func (*Node) ResyncInterfacesAndIPs ¶
func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *logrus.Entry) (available ipamTypes.AllocationMap, remainAvailableENIsCount int, err error)
ResyncInterfacesAndIPs is called to retrieve and ENIs and IPs as known to the AlibabaCloud API and return them
func (*Node) UpdatedNode ¶
func (n *Node) UpdatedNode(obj *v2.CiliumNode)
UpdatedNode is called when an update to the CiliumNode is received.