 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CIDRRangeNoCIDRsRemainingErr ¶
type CIDRRangeNoCIDRsRemainingErr struct {
	// CIDR represents the CIDR which is exhausted.
	CIDR string
}
    CIDRRangeNoCIDRsRemainingErr is an error type used to denote there is no more space to allocate CIDR ranges from the given CIDR.
func (*CIDRRangeNoCIDRsRemainingErr) Error ¶
func (err *CIDRRangeNoCIDRsRemainingErr) Error() string
type CIDRSetSubNetTooBigErr ¶
type CIDRSetSubNetTooBigErr struct {
	// contains filtered or unexported fields
}
    CIDRSetSubNetTooBigErr is an error type to denote that subnet mask size is too big compared to the CIDR mask size.
func (*CIDRSetSubNetTooBigErr) Error ¶
func (err *CIDRSetSubNetTooBigErr) Error() string
type ClusterCIDR ¶
type ClusterCIDR struct {
	// Name of the associated ClusterCIDR API object.
	Name string
	// IPv4CIDRSet is the MultiCIDRSet representation of ClusterCIDR.spec.ipv4
	// of the associated ClusterCIDR API object.
	IPv4CIDRSet *MultiCIDRSet
	// IPv6CIDRSet is the MultiCIDRSet representation of ClusterCIDR.spec.ipv6
	// of the associated ClusterCIDR API object.
	IPv6CIDRSet *MultiCIDRSet
	// AssociatedNodes is used to identify which nodes have CIDRs allocated from this ClusterCIDR.
	// Stores a mapping of node name to association status.
	AssociatedNodes map[string]bool
	// Terminating is used to identify whether ClusterCIDR has been marked for termination.
	Terminating bool
}
    ClusterCIDR is an internal representation of the ClusterCIDR API object.
type MultiCIDRSet ¶
type MultiCIDRSet struct {
	sync.Mutex
	// ClusterCIDR is the CIDR assigned to the cluster.
	ClusterCIDR *net.IPNet
	// NodeMaskSize is the mask size, in bits,assigned to the nodes
	// caches the mask size to avoid the penalty of calling nodeMask.Size().
	NodeMaskSize int
	// MaxCIDRs is the maximum number of CIDRs that can be allocated.
	MaxCIDRs int
	// Label stores the CIDR in a string, it is used to identify the metrics such
	// as Number of allocations, Total number of CIDR releases, Percentage of
	// allocated CIDRs, Tries required for allocating a CIDR for a particular CIDRSet.
	Label string
	// AllocatedCIDRMap stores all the allocated CIDRs from the current CIDRSet.
	// Stores a mapping of the next candidate CIDR for allocation to it's
	// allocation status. Next candidate is used only if allocation status is false.
	AllocatedCIDRMap map[string]bool
	// contains filtered or unexported fields
}
    MultiCIDRSet manages a set of CIDR ranges from which blocks of IPs can be allocated from.
func NewMultiCIDRSet ¶
func NewMultiCIDRSet(cidrConfig *net.IPNet, perNodeHostBits int) (*MultiCIDRSet, error)
NewMultiCIDRSet creates a new MultiCIDRSet.
func (*MultiCIDRSet) NextCandidate ¶
func (s *MultiCIDRSet) NextCandidate() (*net.IPNet, int, error)
NextCandidate returns the next candidate and the last evaluated index for the current cidrSet. Returns nil if the candidate is already allocated.
func (*MultiCIDRSet) Occupy ¶
func (s *MultiCIDRSet) Occupy(cidr *net.IPNet) (err error)
Occupy marks the given CIDR range as used. Occupy succeeds even if the CIDR range was previously used.
func (*MultiCIDRSet) Release ¶
func (s *MultiCIDRSet) Release(cidr *net.IPNet) error
Release releases the given CIDR range.
func (*MultiCIDRSet) UpdateEvaluatedCount ¶
func (s *MultiCIDRSet) UpdateEvaluatedCount(evaluated int)
UpdateEvaluatedCount increments the evaluated count.