ipam

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package ipam contains helper functions to create, update and delete ipam related resources in a Kubernetes cluster

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingAddresses = errors.New("no valid ip addresses defined for the ip pool")

ErrMissingAddresses is returned when the cluster IPAM config does not contain any addresses.

Functions

func InClusterPoolFormat

func InClusterPoolFormat(cluster *infrav1.ProxmoxCluster, format string) string

InClusterPoolFormat returns the name of the `InClusterIPPool` for a given cluster.

Types

type Helper

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

Helper provides handling of ipam objects such as, InClusterPool, IPAddressClaim.

func NewHelper

func NewHelper(c client.Client, infraCluster *infrav1.ProxmoxCluster) *Helper

NewHelper creates new Helper.

func (*Helper) CreateIPAddressClaim

func (h *Helper) CreateIPAddressClaim(ctx context.Context, owner client.Object, device, format, clusterNameLabel string, ref *corev1.TypedLocalObjectReference) error

CreateIPAddressClaim creates an IPAddressClaim for a given object.

func (*Helper) CreateOrUpdateInClusterIPPool

func (h *Helper) CreateOrUpdateInClusterIPPool(ctx context.Context) error

CreateOrUpdateInClusterIPPool creates or updates an `InClusterIPPool` which will be used by the `cluster-api-ipam-provider-in-cluster` to provide IP addresses for new nodes. We also need to create this resource to pre-allocate IP addresses which are already in use by Proxmox in order to avoid conflicts.

func (*Helper) GetDefaultInClusterIPPool

func (h *Helper) GetDefaultInClusterIPPool(ctx context.Context, format string) (*ipamicv1.InClusterIPPool, error)

GetDefaultInClusterIPPool attempts to retrieve the `InClusterIPPool` which is managed by the cluster.

func (*Helper) GetGlobalInClusterIPPool

func (h *Helper) GetGlobalInClusterIPPool(ctx context.Context, ref *corev1.TypedLocalObjectReference) (*ipamicv1.GlobalInClusterIPPool, error)

GetGlobalInClusterIPPool attempts to retrieve the referenced `GlobalInClusterIPPool`.

func (*Helper) GetIPAddress

func (h *Helper) GetIPAddress(ctx context.Context, key client.ObjectKey) (*ipamv1.IPAddress, error)

GetIPAddress attempts to retrieve the IPAddress.

func (*Helper) GetInClusterIPPool

func (h *Helper) GetInClusterIPPool(ctx context.Context, ref *corev1.TypedLocalObjectReference) (*ipamicv1.InClusterIPPool, error)

GetInClusterIPPool attempts to retrieve the referenced `InClusterIPPool`.

Jump to

Keyboard shortcuts

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