ipam

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChildrenExistGenericFn

func ChildrenExistGenericFn(alloc *Allocation, route *table.Route) string

func ChildrenExistLoopbackFn

func ChildrenExistLoopbackFn(alloc *Allocation, route *table.Route) string

func ChildrenExistNopFn

func ChildrenExistNopFn(alloc *Allocation, route *table.Route) string

func ExactPrefixMatchGenericFn

func ExactPrefixMatchGenericFn(alloc *Allocation, route *table.Route) string

func ExactPrefixMatchNetworkFn

func ExactPrefixMatchNetworkFn(alloc *Allocation, route *table.Route) string

func FinalValidationNetworkFn

func FinalValidationNetworkFn(alloc *Allocation, dryrunrt *table.RouteTable) string

func FinalValidationNopFn

func FinalValidationNopFn(alloc *Allocation, dryrunrt *table.RouteTable) string

func GetNameFromNetworkInstancePrefix added in v0.0.2

func GetNameFromNetworkInstancePrefix(cr *ipamv1alpha1.NetworkInstance, prefix string) string

func IsAddressGenericFn

func IsAddressGenericFn(alloc *Allocation) string

func IsAddressInNetGenericFn

func IsAddressInNetGenericFn(alloc *Allocation) string

func IsAddressInNetNopFn

func IsAddressInNetNopFn(alloc *Allocation) string

func IsAddressNopFn

func IsAddressNopFn(alloc *Allocation) string

func NoParentExistAggregateFn added in v0.0.2

func NoParentExistAggregateFn(alloc *Allocation) string

func NoParentExistGenericFn added in v0.0.2

func NoParentExistGenericFn(alloc *Allocation) string

func ParentExistAggregateFn

func ParentExistAggregateFn(alloc *Allocation, route *table.Route) string

func ParentExistLoopbackFn

func ParentExistLoopbackFn(alloc *Allocation, route *table.Route) string

func ParentExistNetworkFn

func ParentExistNetworkFn(alloc *Allocation, route *table.Route) string

func ParentExistPoolFn

func ParentExistPoolFn(alloc *Allocation, route *table.Route) string

func ValidateInputGenericWithPrefixFn added in v0.0.2

func ValidateInputGenericWithPrefixFn(alloc *Allocation) string

func ValidateInputGenericWithoutPrefixFn added in v0.0.2

func ValidateInputGenericWithoutPrefixFn(alloc *Allocation) string

func ValidateInputNopFn

func ValidateInputNopFn(alloc *Allocation) string

Types

type AllocatedPrefix

type AllocatedPrefix struct {
	Prefix  string
	Gateway string
}

type Allocation

type Allocation struct {
	Origin          ipamv1alpha1.Origin        `json:"origin,omitempty" yaml:"origin,omitempty"`
	NamespacedName  types.NamespacedName       `json:"namespacedName,omitempty" yaml:"namespacedName,omitempty"`
	PrefixKind      ipamv1alpha1.PrefixKind    `json:"prefixKind,omitempty" yaml:"prefixKind,omitempty"`
	NetworkInstance string                     `json:"networkInstance,omitempty" yaml:"networkInstance,omitempty"`
	Prefix          string                     `json:"prefix,omitempty" yaml:"prefix,omitempty"`
	AddresFamily    ipamv1alpha1.AddressFamily `json:"addressFamily,omitempty" yaml:"addressFamily,omitempty"` // used for alloc w/o prefix
	PrefixLength    uint8                      `json:"prefixLength,omitempty" yaml:"prefixLength,omitempty"`   // used for alloc w/o prefix and prefix kind = pool
	SpecLabels      map[string]string          `json:"specLabels,omitempty" yaml:"specLabels,omitempty"`       // labels in the spec
	SelectorLabels  map[string]string          `json:"selectorLabels,omitempty" yaml:"selectorLabels,omitempty"`
}

+k8s:deepcopy-gen=false

func BuildAllocationFromGRPCAlloc

func BuildAllocationFromGRPCAlloc(alloc *allocpb.Request) *Allocation

func BuildAllocationFromIPAllocation

func BuildAllocationFromIPAllocation(cr *ipamv1alpha1.IPAllocation) *Allocation

func BuildAllocationFromIPPrefix

func BuildAllocationFromIPPrefix(cr *ipamv1alpha1.IPPrefix) *Allocation

func BuildAllocationFromNetworkInstancePrefix added in v0.0.2

func BuildAllocationFromNetworkInstancePrefix(cr *ipamv1alpha1.NetworkInstance, prefix *ipamv1alpha1.Prefix) *Allocation

func (*Allocation) DeepCopy

func (in *Allocation) DeepCopy() (*Allocation, error)

func (*Allocation) GetAddressFamily

func (r *Allocation) GetAddressFamily() ipamv1alpha1.AddressFamily

func (*Allocation) GetAllocSelector

func (r *Allocation) GetAllocSelector() (labels.Selector, error)

func (*Allocation) GetFullLabels

func (r *Allocation) GetFullLabels() map[string]string

func (*Allocation) GetFullSelector

func (r *Allocation) GetFullSelector() (labels.Selector, error)

func (*Allocation) GetGatewayLabelSelector

func (r *Allocation) GetGatewayLabelSelector() (labels.Selector, error)

func (*Allocation) GetIPPrefix

func (r *Allocation) GetIPPrefix() netaddr.IPPrefix

func (*Allocation) GetLabelSelector

func (r *Allocation) GetLabelSelector() (labels.Selector, error)

func (*Allocation) GetLabels

func (r *Allocation) GetLabels() map[string]string

func (*Allocation) GetNINamespacedName

func (r *Allocation) GetNINamespacedName() types.NamespacedName

func (*Allocation) GetName

func (r *Allocation) GetName() string

func (*Allocation) GetNameSpace

func (r *Allocation) GetNameSpace() string

func (*Allocation) GetNetworkInstance

func (r *Allocation) GetNetworkInstance() string

func (*Allocation) GetOrigin

func (r *Allocation) GetOrigin() ipamv1alpha1.Origin

func (*Allocation) GetPrefix

func (r *Allocation) GetPrefix() string

func (*Allocation) GetPrefixFromNewAlloc

func (r *Allocation) GetPrefixFromNewAlloc() string

func (*Allocation) GetPrefixKind

func (r *Allocation) GetPrefixKind() ipamv1alpha1.PrefixKind

func (*Allocation) GetPrefixLengthFromRoute

func (r *Allocation) GetPrefixLengthFromRoute(route *table.Route) uint8

func (*Allocation) GetSelectorLabels

func (r *Allocation) GetSelectorLabels() map[string]string

func (*Allocation) GetSubnetLabelSelector added in v0.0.2

func (r *Allocation) GetSubnetLabelSelector() (labels.Selector, error)

type ChildrenExistFn

type ChildrenExistFn func(alloc *Allocation, route *table.Route) string

type ExactPrefixMatchFn

type ExactPrefixMatchFn func(alloc *Allocation, route *table.Route) string

type FinalValidationFn

type FinalValidationFn func(alloc *Allocation, dryrunrt *table.RouteTable) string

type InsertorFn

type InsertorFn func(ctx context.Context, alloc *Allocation, init bool) (*AllocatedPrefix, error)

type Ipam

type Ipam interface {
	// Init
	Init(ctx context.Context, cr *ipamv1alpha1.NetworkInstance) error
	// Delete the ipam instance
	Delete(string)
	// AllocateIPPrefix allocates an ip prefix
	AllocateIPPrefix(ctx context.Context, alloc *Allocation) (*AllocatedPrefix, error)
	// DeAllocateIPPrefix
	DeAllocateIPPrefix(ctx context.Context, alloc *Allocation) error
}

func New

func New(c client.Client, opts ...Option) Ipam

type IsAddressFn

type IsAddressFn func(alloc *Allocation) string

type IsAddressInNetFn

type IsAddressInNetFn func(alloc *Allocation) string

type MutatorFn

type MutatorFn func(alloc *Allocation) []*Allocation

type NoParentExistFn added in v0.0.2

type NoParentExistFn func(alloc *Allocation) string

type Option

type Option func(Ipam)

Option can be used to manipulate Options.

type ParentExistFn

type ParentExistFn func(alloc *Allocation, route *table.Route) string

type ValidateInputFn

type ValidateInputFn func(alloc *Allocation) string

type ValidationConfig

type ValidationConfig struct {
	ValidateInputFn    ValidateInputFn
	IsAddressFn        IsAddressFn
	IsAddressInNetFn   IsAddressInNetFn
	ExactPrefixMatchFn ExactPrefixMatchFn
	ChildrenExistFn    ChildrenExistFn
	NoParentExistFn    NoParentExistFn
	ParentExistFn      ParentExistFn
	FinalValidationFn  FinalValidationFn
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL