Documentation
¶
Overview ¶
Package ipam implements Azure IPAM logic
Index ¶
- type AzureAPI
- type InstancesManager
- func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, n *nodemanager.Node) nodemanager.NodeOperations
- func (m *InstancesManager) DeleteInstance(instanceID string)
- func (m *InstancesManager) GetPoolQuota() (quota ipamTypes.PoolQuotaMap)
- func (m *InstancesManager) HasInstance(instanceID string) bool
- func (m *InstancesManager) InstanceSync(ctx context.Context, instanceID string) (time.Time, error)
- func (m *InstancesManager) Resync(ctx context.Context) (time.Time, error)
- type Node
- func (n *Node) AllocateIPs(ctx context.Context, a *nodemanager.AllocationAction) error
- func (n *Node) AllocateStaticIP(ctx context.Context, staticIPTags ipamTypes.Tags) (string, error)
- func (n *Node) CreateInterface(ctx context.Context, allocation *nodemanager.AllocationAction, ...) (int, string, error)
- func (n *Node) GetAttachedCIDRs() []netip.Prefix
- func (n *Node) GetMaximumAllocatableIPv4() int
- func (n *Node) GetMinimumAllocatableIPv4() int
- func (n *Node) IsPrefixDelegated() bool
- func (n *Node) PopulateStatusFields(k8sObj *v2.CiliumNode)
- func (n *Node) PrepareCIDRRelease(_ []netip.Prefix) []*nodemanager.ReleaseAction
- func (n *Node) PrepareIPAllocation(scopedLog *slog.Logger) (a *nodemanager.AllocationAction, err error)
- func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *slog.Logger) *nodemanager.ReleaseAction
- func (n *Node) ReleaseCIDRs(_ context.Context, _ *nodemanager.ReleaseAction) ([]netip.Prefix, error)
- func (n *Node) ReleaseIPPrefixes(ctx context.Context, r *nodemanager.ReleaseAction) error
- func (n *Node) ReleaseIPs(ctx context.Context, r *nodemanager.ReleaseAction) error
- func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *slog.Logger) (available ipamTypes.AllocationMap, stats stats.InterfaceStats, 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 AzureAPI ¶
type AzureAPI interface {
GetSubnetsByIDs(ctx context.Context, nodeSubnetIDs []string) (ipamTypes.SubnetMap, error)
AssignPrivateIpAddressesVM(ctx context.Context, subnetID, interfaceName string, addresses int) error
AssignPrivateIpAddressesVMSS(ctx context.Context, instanceID, vmssName, subnetID, interfaceName string, addresses int) error
AssignPublicIPAddressesVM(ctx context.Context, instanceID string, publicIpTags ipamTypes.Tags) (netip.Addr, error)
AssignPublicIPAddressesVMSS(ctx context.Context, instanceID, vmssName string, publicIpTags ipamTypes.Tags) (netip.Addr, error)
ListAllNetworkInterfaces(ctx context.Context) ([]*armnetwork.Interface, error)
ParseInterfacesIntoInstanceMap(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.InstanceMap
ListVMNetworkInterfaces(ctx context.Context, instanceID string) ([]*armnetwork.Interface, error)
ParseInterfacesIntoInstance(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.Instance
}
AzureAPI is the API surface used of the Azure 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(logger *slog.Logger, api AzureAPI, usePrimary bool) *InstancesManager
NewInstancesManager returns a new instances manager
func (*InstancesManager) CreateNode ¶
func (m *InstancesManager) CreateNode(obj *v2.CiliumNode, n *nodemanager.Node) nodemanager.NodeOperations
CreateNode is called on discovery of a new node
func (*InstancesManager) DeleteInstance ¶
func (m *InstancesManager) DeleteInstance(instanceID string)
DeleteInstance delete instance from m.instances
func (*InstancesManager) GetPoolQuota ¶
func (m *InstancesManager) GetPoolQuota() (quota ipamTypes.PoolQuotaMap)
GetPoolQuota returns the number of available IPs in all IP pools
func (*InstancesManager) HasInstance ¶
func (m *InstancesManager) HasInstance(instanceID string) bool
HasInstance returns whether the instance is in instances
func (*InstancesManager) InstanceSync ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a node representing an Azure instance
func (*Node) AllocateIPs ¶
func (n *Node) AllocateIPs(ctx context.Context, a *nodemanager.AllocationAction) error
AllocateIPs performs the Azure IP allocation operation
func (*Node) AllocateStaticIP ¶ added in v1.17.0
func (*Node) CreateInterface ¶
func (n *Node) CreateInterface(ctx context.Context, allocation *nodemanager.AllocationAction, scopedLog *slog.Logger) (int, string, error)
CreateInterface is called to create a new interface. This operation is currently not supported on Azure.
func (*Node) GetAttachedCIDRs ¶ added in v1.20.0
GetAttachedCIDRs is a no-op since Azure does not use multi-pool but uses the CRD allocator.
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) IsPrefixDelegated ¶
func (*Node) PopulateStatusFields ¶
func (n *Node) PopulateStatusFields(k8sObj *v2.CiliumNode)
PopulateStatusFields fills in the status field of the CiliumNode custom resource with Azure specific information
func (*Node) PrepareCIDRRelease ¶ added in v1.20.0
func (n *Node) PrepareCIDRRelease(_ []netip.Prefix) []*nodemanager.ReleaseAction
PrepareCIDRRelease is a no-op since Azure does not use multi-pool but uses the CRD allocator, that's backed by PrepareIPRelease
func (*Node) PrepareIPAllocation ¶
func (n *Node) PrepareIPAllocation(scopedLog *slog.Logger) (a *nodemanager.AllocationAction, err error)
PrepareIPAllocation returns the number of IPs that can be allocated/created.
func (*Node) PrepareIPRelease ¶
func (n *Node) PrepareIPRelease(excessIPs int, scopedLog *slog.Logger) *nodemanager.ReleaseAction
PrepareIPRelease prepares the release of IPs
func (*Node) ReleaseCIDRs ¶ added in v1.20.0
func (n *Node) ReleaseCIDRs(_ context.Context, _ *nodemanager.ReleaseAction) ([]netip.Prefix, error)
ReleaseCIDRs is a no-op since Azure does not use multi-pool but uses the CRD allocator, that's backed by ReleaseIPs/ReleaseIPPrefixes
func (*Node) ReleaseIPPrefixes ¶ added in v1.19.0
func (n *Node) ReleaseIPPrefixes(ctx context.Context, r *nodemanager.ReleaseAction) error
ReleaseIPPrefixes is a no-op on Azure since Azure ENIs don't support prefix delegation.
func (*Node) ReleaseIPs ¶
func (n *Node) ReleaseIPs(ctx context.Context, r *nodemanager.ReleaseAction) error
ReleaseIPs performs the IP release operation
func (*Node) ResyncInterfacesAndIPs ¶
func (n *Node) ResyncInterfacesAndIPs(ctx context.Context, scopedLog *slog.Logger) ( available ipamTypes.AllocationMap, stats stats.InterfaceStats, err error)
ResyncInterfacesAndIPs is called to retrieve interfaces and IPs known to the Azure 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.