ipam

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReleaseAddressFinalizer is used to release an IP address before cleaning up the claim.
	ReleaseAddressFinalizer = "netbox.ipam.cluster.x-k8s.io/ReleaseAddress"

	// ProtectAddressFinalizer is used to prevent deletion of an IPAddress object while its claim is not deleted.
	ProtectAddressFinalizer = "netbox.ipam.cluster.x-k8s.io/ProtectAddress"
)

Variables

This section is empty.

Functions

func AddIPAddressClaimReconciler

func AddIPAddressClaimReconciler(ctx context.Context, mgr manager.Manager, watchFilter string) error

func AddressReferencesPoolKind

func AddressReferencesPoolKind(gk metav1.GroupKind) predicate.Funcs

AddressReferencesPoolKind is a predicate that ensures an ipamv1.IPAddress references a specified pool kind.

func ClaimReferencesPoolKind

func ClaimReferencesPoolKind(gk metav1.GroupKind) predicate.Funcs

func NewIPAddress

func NewIPAddress(claim *ipamv1.IPAddressClaim, pool client.Object) ipamv1.IPAddress

NewIPAddress creates a new ipamv1.IPAddress with references to a pool and claim.

Types

type ClaimHandler

type ClaimHandler interface {
	// FetchPool is called to fetch the pool referenced by the claim. The pool needs to be stored by the handler.
	FetchPool(ctx context.Context) (client.Object, *ctrl.Result, error)
	// EnsureAddress is called to make sure that the IPAddress.Spec is correct and the address is allocated.
	EnsureAddress(ctx context.Context, address *ipamv1.IPAddress) (*ctrl.Result, error)
	// ReleaseAddress is called to release the ip address that was allocated for the claim.
	ReleaseAddress(ctx context.Context) (*ctrl.Result, error)
}

ClaimHandler knows how to allocate and release IP addresses for a specific provider.

type IPAddressClaimHandler

type IPAddressClaimHandler struct {
	client.Client
	// contains filtered or unexported fields
}

IPAddressClaimHandler reconciles a InClusterIPPool object.

func (*IPAddressClaimHandler) EnsureAddress

func (h *IPAddressClaimHandler) EnsureAddress(ctx context.Context, address *ipamv1.IPAddress) (*ctrl.Result, error)

EnsureAddress ensures that the IPAddress contains a valid address.

func (*IPAddressClaimHandler) FetchPool

FetchPool fetches the (Global)InClusterIPPool.

func (*IPAddressClaimHandler) ReleaseAddress

func (h *IPAddressClaimHandler) ReleaseAddress(_ context.Context) (*ctrl.Result, error)

type IPAddressClaimReconciler

type IPAddressClaimReconciler struct {
	client.Client
	Scheme           *runtime.Scheme
	WatchFilterValue string
	Adapter          ProviderAdapter
}

IPAddressClaimReconciler reconciles a IPAddressClaim object

func (*IPAddressClaimReconciler) Reconcile

func (r *IPAddressClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error)

Reconcile is called by the controller to reconcile a claim.

type NetboxProviderAdapter

type NetboxProviderAdapter struct {
	Client           client.Client
	WatchFilterValue string
}

NetboxProviderAdapter is used as middle layer for provider integration.

func (*NetboxProviderAdapter) ClaimHandlerFor

func (a *NetboxProviderAdapter) ClaimHandlerFor(_ client.Client, claim *ipamv1.IPAddressClaim) ClaimHandler

func (*NetboxProviderAdapter) SetupWithManager

func (a *NetboxProviderAdapter) SetupWithManager(_ context.Context, b *ctrl.Builder) error

type ProviderAdapter

type ProviderAdapter interface {
	// SetupWithManager will be called during the setup of the controller for the ClaimReconciler to allow the provider
	// implementation to extend the controller configuration.
	SetupWithManager(context.Context, *ctrl.Builder) error
	// ClaimHandlerFor is called during reconciliation to get a ClaimHandler for the reconciled [ipamv1.IPAddressClaim].
	ClaimHandlerFor(client.Client, *ipamv1.IPAddressClaim) ClaimHandler
}

ProviderAdapter is an interface that must be implemented by the IPAM provider.

Jump to

Keyboard shortcuts

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