ippool

package
v0.0.0-...-f8ce8b3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AnnotationReservedIP is the annotation key used to reserve an IP
	AnnotationReservedIP = "ipv4.bonding.vpn.gardener.cloud/reserved"
	// AnnotationReservedIP is the annotation key used to store an IP as used
	AnnotationUsedIP = "ipv4.bonding.vpn.gardener.cloud/used"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAddressBroker

type IPAddressBroker = *ipAddressBroker

IPAddressBroker is the broker to retrieve a IP from the IP pool

func NewIPAddressBroker

func NewIPAddressBroker(manager IPPoolManager, cfg *config.VPNClient) (IPAddressBroker, error)

NewIPAddressBroker creates a new instance.

type IPPoolManager

type IPPoolManager interface {
	// UsageLookup collects all IPs used or reserved.
	UsageLookup(ctx context.Context, podName string) (*IPPoolUsageLookupResult, error)
	// SetIPAddress sets an IP for a pod name as reserved or used.
	SetIPAddress(ctx context.Context, podName, ip string, used bool) error
}

IPPoolManager provides methods to get IP pool usage and for adding new reservations or uses.

func NewPodIPPoolManager

func NewPodIPPoolManager(namespace, labelSelector string) (IPPoolManager, error)

NewPodIPPoolManager create a new IPPoolManager based on pod annotations.

type IPPoolUsageLookupResult

type IPPoolUsageLookupResult struct {
	// OwnName is the own pod name
	OwnName string
	// IP used by own pod
	OwnIP string
	// OwnUsed is true if the own IP is marked as used
	OwnUsed bool
	// ForeignUsed are the set of IPs used by other pods
	ForeignUsed map[string]struct{}
	// ForeignReserved are the set of IPs reserved by other pods
	ForeignReserved map[string]struct{}
}

IPPoolUsageLookupResult contains the results of the IP pool lookup

Jump to

Keyboard shortcuts

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