Documentation
¶
Index ¶
- Constants
- func InitBitmap(size, offset uint) (string, uint)
- func ReleaseOwnedIndex(ctx context.Context, c client.Client, prefix, namespace string, size uint, ...) error
- func ValidateLease(ctx context.Context, c client.Reader, prefix, namespace string, size uint, ...) error
- type Allocator
- type Lease
- func AllocateOwnedIndex(ctx context.Context, c client.Client, prefix, namespace string, size uint, ...) (*Lease, error)
- func FindOwnerLease(ctx context.Context, c client.Reader, prefix, namespace, uid string) (*Lease, error)
- func PinExistingIndex(ctx context.Context, c client.Client, prefix, namespace string, ...) (*Lease, error)
Constants ¶
const ( PoolStateLabel = "allocation.cybericebox.com/state" LatestPoolLabel = "allocation.cybericebox.com/latest" PoolGroupLabel = "allocation.cybericebox.com/group" PoolStateEmpty = "empty" PoolStatePartial = "partial" PoolStateFull = "full" // PoolTypeLabel carries semantic pool type (vni, vpn-clients, lab-subnets). PoolTypeLabel = "pool.cybericebox.com/type" // Semantic pool type values. PoolTypeVPNClients = "vpn-clients" PoolTypeLabSubnets = "lab-subnets" PoolTypeVNI = "vni" )
const CursorAnnotation = "allocation.cybericebox.com/cursor"
CursorAnnotation on a Pool remembers where a rotating allocator handed out last.
Variables ¶
This section is empty.
Functions ¶
func InitBitmap ¶
InitBitmap initialises a pool's bitmap and returns (encodedBitmap, freeCount). Bit 0 is reserved when offset == 0 to avoid assigning the network-address index.
func ReleaseOwnedIndex ¶ added in v1.1.0
Types ¶
type Allocator ¶
type Allocator interface {
AllocateIndex(ctx context.Context) (uint, error)
ReleaseIndex(ctx context.Context, index uint) error
}
func NewAllocator ¶
func NewRotatingAllocator ¶
func NewRotatingAllocator(c client.Client, poolNamePrefix, namespace string, poolSize uint) Allocator
NewRotatingAllocator is NewAllocator with indexes that are not reused until the pool has been walked (see allocator.rotate): the VNIs of the lab networks, where the same number meeting a new lab at once could inherit stale flows on a node.
type Lease ¶ added in v1.1.0
Lease is an immutable reservation epoch. Its UID survives caller/process restart; PoolUID also fences pool deletion/recreation with a reset counter.
func AllocateOwnedIndex ¶ added in v1.1.0
func FindOwnerLease ¶ added in v1.1.0
func PinExistingIndex ¶ added in v1.1.0
func PinExistingIndex(ctx context.Context, c client.Client, prefix, namespace string, size, index uint, uid string) (*Lease, error)
PinExistingIndex upgrades a currently held legacy reservation. It never binds a clear bit or a differently owned lease; all subsequent releases are fenced.