Documentation
¶
Overview ¶
Package ipam provides different allocators for assigning IP ranges to nodes. We currently support several kinds of IPAM allocators (these are denoted by the CIDRAllocatorType):
- RangeAllocator is an allocator that assigns PodCIDRs to nodes and works in conjunction with the RouteController to configure the network to get connectivity.
- CloudAllocator is an allocator that synchronizes PodCIDRs from IP ranges assignments from the underlying cloud platform.
- (Alpha only) IPAMFromCluster is an allocator that has the similar functionality as the RangeAllocator but also synchronizes cluster-managed ranges into the cloud platform.
- (Alpha only) IPAMFromCloud is the same as CloudAllocator (synchronizes from cloud into the cluster.)
Index ¶
- Variables
- type CIDRAllocator
- func New(ctx context.Context, kubeClient clientset.Interface, _ cloudprovider.Interface, ...) (CIDRAllocator, error)
- func NewCIDRCloudAllocator(ctx context.Context, client clientset.Interface, ...) (CIDRAllocator, error)
- func NewCIDRRangeAllocator(ctx context.Context, client clientset.Interface, ...) (CIDRAllocator, error)
- type CIDRAllocatorParams
- type CIDRAllocatorType
Constants ¶
This section is empty.
Variables ¶
var ( // UninitializedTaint is the taint that is added to nodes that are not yet initialized. UninitializedTaint = &v1.Taint{ Key: cloudproviderapi.TaintExternalCloudProvider, Effect: v1.TaintEffectNoSchedule, } )
Functions ¶
This section is empty.
Types ¶
type CIDRAllocator ¶
type CIDRAllocator interface {
// AllocateOrOccupyCIDR looks at the given node, assigns it a valid
// CIDR if it doesn't currently have one or mark the CIDR as used if
// the node already have one.
AllocateOrOccupyCIDR(ctx context.Context, node *v1.Node) error
// ReleaseCIDR releases the CIDR of the removed node.
ReleaseCIDR(logger klog.Logger, node *v1.Node) error
// Run starts all the working logic of the allocator.
Run(ctx context.Context)
}
CIDRAllocator is an interface implemented by things that know how to allocate/occupy/recycle CIDR for nodes.
func New ¶
func New( ctx context.Context, kubeClient clientset.Interface, _ cloudprovider.Interface, nodeInformer informers.NodeInformer, allocatorType CIDRAllocatorType, allocatorParams CIDRAllocatorParams, ) (CIDRAllocator, error)
New creates a new CIDR range allocator.
func NewCIDRCloudAllocator ¶
func NewCIDRCloudAllocator( ctx context.Context, client clientset.Interface, nodeInformer informers.NodeInformer, allocatorParams CIDRAllocatorParams, nodeList *v1.NodeList, ) (CIDRAllocator, error)
NewCIDRCloudAllocator returns a CIDRAllocator to allocate CIDRs for node (one from each of clusterCIDRs) Caller must ensure subNetMaskSize is not less than cluster CIDR mask size. Caller must always pass in a list of existing nodes so the new allocator. Caller must ensure that ClusterCIDRs are semantically correct e.g (1 for non DualStack, 2 for DualStack etc..) can initialize its CIDR map. NodeList is only nil in testing.
func NewCIDRRangeAllocator ¶
func NewCIDRRangeAllocator(ctx context.Context, client clientset.Interface, nodeInformer informers.NodeInformer, allocatorParams CIDRAllocatorParams, nodeList *v1.NodeList) (CIDRAllocator, error)
NewCIDRRangeAllocator returns a CIDRAllocator to allocate CIDRs for node (one from each of clusterCIDRs) Caller must ensure subNetMaskSize is not less than cluster CIDR mask size. Caller must always pass in a list of existing nodes so the new allocator. Caller must ensure that ClusterCIDRs are semantically correct e.g (1 for non DualStack, 2 for DualStack etc..) can initialize its CIDR map. NodeList is only nil in testing.
type CIDRAllocatorParams ¶
type CIDRAllocatorParams struct {
// ClusterCIDRs is list of cluster cidrs.
ClusterCIDRs []*net.IPNet
// ServiceCIDR is primary service cidr for cluster.
ServiceCIDR *net.IPNet
// SecondaryServiceCIDR is secondary service cidr for cluster.
SecondaryServiceCIDR *net.IPNet
// NodeCIDRMaskSizes is list of node cidr mask sizes.
NodeCIDRMaskSizes []int
}
CIDRAllocatorParams is parameters that's required for creating new cidr range allocator.
type CIDRAllocatorType ¶
type CIDRAllocatorType string
CIDRAllocatorType is the type of the allocator to use.
const ( // RangeAllocatorType is the allocator that uses an internal CIDR // range allocator to do node CIDR range allocations. RangeAllocatorType CIDRAllocatorType = "RangeAllocator" // CloudAllocatorType is the allocator that uses cloud platform // support to do node CIDR range allocations. CloudAllocatorType CIDRAllocatorType = "CloudAllocator" )