ip

package
v1.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Package ip provide helpers for ip address management if a vCenter cluster.

Index

Constants

View Source
const (
	ControlPlaneEndpointIPVariable = "CONTROL_PLANE_ENDPOINT_IP"
)

Variables

This section is empty.

Functions

func GetIPAddressClaimLabels

func GetIPAddressClaimLabels() map[string]string

GetIPAddressClaimLabels returns a labels map from the prow environment variables BUILD_ID and JOB_NAME. If none of both is set it falls back to add a custom random label.

Types

type AddressClaim

type AddressClaim types.NamespacedName

type AddressClaims

type AddressClaims []AddressClaim

type AddressManager

type AddressManager interface {
	// ClaimIPs claims IP addresses with the variable name `CONTROL_PLANE_ENDPOINT_IP` and whatever is passed as
	// additionalIPVariableNames.
	// It returns a slice of IPAddressClaims namespaced names and corresponding variables.
	ClaimIPs(ctx context.Context, opts ...ClaimOption) (claims AddressClaims, variables map[string]string)

	// Cleanup deletes the given IPAddressClaims.
	Cleanup(ctx context.Context, claims AddressClaims) error

	// Teardown tries to cleanup orphaned IPAddressClaims by checking if the corresponding IPs are still in use in vSphere.
	// It identifies IPAddressClaims via labels.
	Teardown(ctx context.Context, options ...TearDownOption) error
}

func InClusterAddressManager

func InClusterAddressManager(ctx context.Context, client client.Client, e2eIPPool string, labels map[string]string, skipCleanup bool) (AddressManager, error)

InClusterAddressManager returns an ip.AddressManager implementation that leverage on the IPAM provider installed into the management cluster. If e2eIPAMKubeconfig is an empty string it will return a noop AddressManager which does nothing so we can fallback on setting environment variables.

func VCSIMAddressManager

func VCSIMAddressManager(client client.Client, labels map[string]string, skipCleanup bool) (AddressManager, error)

VCSIMAddressManager returns an ip.AddressManager implementation that leverage vcsim controller capabilities.

type ClaimOption

type ClaimOption func(*claimOptions)

func WithGateway

func WithGateway(variableName string) ClaimOption

WithGateway instructs Setup to store the Gateway IP from IPAM into the provided variableName.

func WithIP

func WithIP(variableName ...string) ClaimOption

WithIP instructs Setup to allocate another IP and store it into the provided variableName NOTE: Setup always allocate an IP for CONTROL_PLANE_ENDPOINT_IP.

func WithPrefix added in v1.10.1

func WithPrefix(variableName string) ClaimOption

WithPrefix instructs Setup to store the prefix from IPAM into the provided variableName.

type TearDownOption

type TearDownOption func(*teardownOptions)

TearDownOption is a configuration option supplied to Teardown.

func MachineFolder

func MachineFolder(name string) TearDownOption

MachineFolder instructs Teardown about where machines are located. NOTE: This option applies only to the in cluster address manager.

func VSphereClient

func VSphereClient(c *govmomi.Client) TearDownOption

VSphereClient provides Teardown a vCenter client. NOTE: This option applies only to the in cluster address manager.

Jump to

Keyboard shortcuts

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