kubernetes

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const UnnamedNetwork string = ""

Variables

This section is empty.

Functions

func IPManagement

func IPManagement(ctx context.Context, mode int, ipamConf whereaboutstypes.IPAMConfig, client *KubernetesIPAM) ([]net.IPNet, error)

IPManagement manages ip allocation and deallocation from a storage perspective

func IPManagementKubernetesUpdate

func IPManagementKubernetesUpdate(ctx context.Context, mode int, ipam *KubernetesIPAM, ipamConf whereaboutstypes.IPAMConfig) ([]net.IPNet, error)

IPManagementKubernetesUpdate manages k8s updates

func IPPoolName added in v0.6.2

func IPPoolName(poolIdentifier PoolIdentifier) string

func NormalizeIP added in v0.8.0

func NormalizeIP(ip net.IP, networkName string) string

NormalizeIP normalizes the IP. This is important for IPv6 which doesn't make for valid CR names. It also allows us to add the network-name when it's different from the unnamed network.

Types

type Client

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

Client has info on how to connect to the kubernetes cluster

func NewClient

func NewClient() (*Client, error)

func NewClientViaKubeconfig

func NewClientViaKubeconfig(kubeconfigPath string) (*Client, error)

func NewKubernetesClient added in v0.6.1

func NewKubernetesClient(k8sClient wbclient.Interface, k8sClientSet kubernetes.Interface) *Client

func (*Client) DeleteOverlappingIP

func (i *Client) DeleteOverlappingIP(clusterWideIP *whereaboutsv1alpha1.OverlappingRangeIPReservation) error

func (*Client) GetPod added in v0.6.3

func (i *Client) GetPod(namespace, name string) (*v1.Pod, error)

func (*Client) ListIPPools

func (i *Client) ListIPPools() ([]storage.IPPool, error)

func (*Client) ListOverlappingIPs

func (i *Client) ListOverlappingIPs() ([]whereaboutsv1alpha1.OverlappingRangeIPReservation, error)

func (*Client) ListPods

func (i *Client) ListPods() ([]v1.Pod, error)

type KubernetesIPAM

type KubernetesIPAM struct {
	Client
	Config whereaboutstypes.IPAMConfig

	IfName string
	// contains filtered or unexported fields
}

KubernetesIPAM manages ip blocks in an kubernetes CRD backend

func NewKubernetesIPAM

func NewKubernetesIPAM(containerID, ifName string, ipamConf whereaboutstypes.IPAMConfig) (*KubernetesIPAM, error)

NewKubernetesIPAM returns a new KubernetesIPAM Client configured to a kubernetes CRD backend

func NewKubernetesIPAMWithNamespace added in v0.5.3

func NewKubernetesIPAMWithNamespace(containerID, ifName string, ipamConf whereaboutstypes.IPAMConfig, namespace string) (*KubernetesIPAM, error)

NewKubernetesIPAMWithNamespace returns a new KubernetesIPAM Client configured to a kubernetes CRD backend

func (*KubernetesIPAM) Close

func (i *KubernetesIPAM) Close() error

Close partially implements the Store interface

func (*KubernetesIPAM) GetIPPool

func (i *KubernetesIPAM) GetIPPool(ctx context.Context, poolIdentifier PoolIdentifier) (storage.IPPool, error)

GetIPPool returns a storage.IPPool for the given range

func (*KubernetesIPAM) GetOverlappingRangeStore

func (i *KubernetesIPAM) GetOverlappingRangeStore() (storage.OverlappingRangeStore, error)

GetOverlappingRangeStore returns a clusterstore interface

func (*KubernetesIPAM) Status

func (i *KubernetesIPAM) Status(ctx context.Context) error

Status tests connectivity to the kubernetes backend

type KubernetesIPPool

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

KubernetesIPPool represents an IPPool resource and its parsed set of allocations

func (*KubernetesIPPool) Allocations

func (p *KubernetesIPPool) Allocations() []whereaboutstypes.IPReservation

Allocations returns the initially retrieved set of allocations for this pool

func (*KubernetesIPPool) Update

func (p *KubernetesIPPool) Update(ctx context.Context, reservations []whereaboutstypes.IPReservation) error

Update sets the pool allocated IP list to the given IP reservations

type KubernetesOverlappingRangeStore

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

KubernetesOverlappingRangeStore represents a OverlappingRangeStore interface

func (*KubernetesOverlappingRangeStore) GetOverlappingRangeIPReservation added in v0.8.0

func (c *KubernetesOverlappingRangeStore) GetOverlappingRangeIPReservation(ctx context.Context, ip net.IP,
	podRef, networkName string) (*whereaboutsv1alpha1.OverlappingRangeIPReservation, error)

IsAllocatedInOverlappingRange checks for IP addresses to see if they're allocated cluster wide, for overlapping ranges. First return value is true if the IP is allocated, second return value is true if the IP is allocated to the current podRef

func (*KubernetesOverlappingRangeStore) UpdateOverlappingRangeAllocation

func (c *KubernetesOverlappingRangeStore) UpdateOverlappingRangeAllocation(ctx context.Context, mode int, ip net.IP,
	podRef, ifName, networkName string) error

UpdateOverlappingRangeAllocation updates clusterwide allocation for overlapping ranges.

type PoolIdentifier added in v0.6.2

type PoolIdentifier struct {
	IpRange     string
	NetworkName string
}

Jump to

Keyboard shortcuts

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