controllers

package
v0.0.0-...-bb83675 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAMCache

type IPAMCache struct {
	// contains filtered or unexported fields
}

IPAMCache caches Ipamer instances for IPPool objects.

func NewIPAMCache

func NewIPAMCache() *IPAMCache

func (*IPAMCache) Free

func (i *IPAMCache) Free(ippool *ipamv1alpha1.IPPool)

Free removes a cached IPAM instance for the given IPPool.

func (*IPAMCache) Get

func (i *IPAMCache) Get(ippool *ipamv1alpha1.IPPool) (Ipamer, bool)

Get returns a cached IPAM instance if it exists.

func (*IPAMCache) GetOrCreate

func (i *IPAMCache) GetOrCreate(
	ctx context.Context, ippool *ipamv1alpha1.IPPool,
	create ipamCreateFn,
) (Ipamer, error)

GetOrCreate returns a cached IPAM instance or calls the createFn to create the instance.

type IPLeaseReconciler

type IPLeaseReconciler struct {
	client.Client
	Log       logr.Logger
	Scheme    *runtime.Scheme
	IPAMCache ipamCache
}

IPLeaseReconciler reconciles a IPLease object

func (*IPLeaseReconciler) Reconcile

func (r *IPLeaseReconciler) Reconcile(
	ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*IPLeaseReconciler) SetupWithManager

func (r *IPLeaseReconciler) SetupWithManager(mgr ctrl.Manager) error

type IPPoolReconciler

type IPPoolReconciler struct {
	client.Client
	Log       logr.Logger
	Scheme    *runtime.Scheme
	IPAMCache ipamCache
	NewIPAM   func() Ipamer
}

IPPoolReconciler reconciles a IPPool object

func (*IPPoolReconciler) Reconcile

func (r *IPPoolReconciler) Reconcile(
	ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)

func (*IPPoolReconciler) SetupWithManager

func (r *IPPoolReconciler) SetupWithManager(mgr ctrl.Manager) error

type Ipamer

type Ipamer interface {
	NewPrefix(cidr string) (*goipam.Prefix, error)
	PrefixFrom(cidr string) *goipam.Prefix
	AcquireIP(cidr string) (*goipam.IP, error)
	AcquireSpecificIP(cidr, ip string) (*goipam.IP, error)
	ReleaseIPFromPrefix(cid, ip string) error
	ReleaseIP(*goipam.IP) (*goipam.Prefix, error)
}

Jump to

Keyboard shortcuts

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