ipam

package
v14.17.1-patch4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Name = "ipam"
)

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

Types

type Checker

type Checker interface {
	Check(ctx context.Context, namespace string, name string) (bool, error)
}

Checker determines whether a subnet has to be allocated. This decision is being made based on the status of the Kubernetes runtime object defined by namespace and name.

type ClusterChecker

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

func NewClusterChecker

func NewClusterChecker(config ClusterCheckerConfig) (*ClusterChecker, error)

func (*ClusterChecker) Check

func (c *ClusterChecker) Check(ctx context.Context, namespace string, name string) (bool, error)

type ClusterCheckerConfig

type ClusterCheckerConfig struct {
	CtrlClient ctrlClient.Client
	Logger     micrologger.Logger
}

type ClusterPersister

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

func NewClusterPersister

func NewClusterPersister(config ClusterPersisterConfig) (*ClusterPersister, error)

func (*ClusterPersister) Persist

func (p *ClusterPersister) Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error

type ClusterPersisterConfig

type ClusterPersisterConfig struct {
	CtrlClient ctrlClient.Client
	Logger     micrologger.Logger
}

type Collector

type Collector interface {
	Collect(ctx context.Context, networkRange net.IPNet) ([]net.IPNet, error)
}

Collector implementation must return all networks that are allocated on any given moment. Failing to do that will result in overlapping allocations which causes cluster creation failures. The network range provided here is a custom override. If it is empty we fall back to some globally configured default.

type Config

type Config struct {
	Checker   Checker
	Collector Collector
	K8sClient k8sclient.Interface
	Locker    locker.Interface
	Logger    micrologger.Logger
	Persister Persister

	AllocatedSubnetMaskBits int
	NetworkRange            net.IPNet
	PrivateSubnetMaskBits   int
	PublicSubnetMaskBits    int
}

type MachineDeploymentChecker

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

func (*MachineDeploymentChecker) Check

func (c *MachineDeploymentChecker) Check(ctx context.Context, namespace string, name string) (bool, error)

type MachineDeploymentCheckerConfig

type MachineDeploymentCheckerConfig struct {
	CtrlClient ctrlClient.Client
	Logger     micrologger.Logger
}

type MachineDeploymentPersister

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

func (*MachineDeploymentPersister) Persist

func (p *MachineDeploymentPersister) Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error

type MachineDeploymentPersisterConfig

type MachineDeploymentPersisterConfig struct {
	CtrlClient ctrlClient.Client
	Logger     micrologger.Logger
}

type Persister

type Persister interface {
	Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error
}

Persister must mutate shared persistent state so that on successful execution persisted networks are visible by Collector implementations.

type Resource

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

func New

func New(config Config) (*Resource, error)

func (*Resource) EnsureCreated

func (r *Resource) EnsureCreated(ctx context.Context, obj interface{}) error

EnsureCreated allocates tenant cluster network segments. It gathers existing subnets from existing system resources like VPCs and Cluster CRs.

func (*Resource) EnsureDeleted

func (r *Resource) EnsureDeleted(ctx context.Context, obj interface{}) error

EnsureDeleted is a NOP for IPAM resource as allocated subnet will get released when the guest cluster VPC and AWSConfig CR is deleted.

func (*Resource) Name

func (r *Resource) Name() string

type SubnetCollector

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

func NewSubnetCollector

func NewSubnetCollector(config SubnetCollectorConfig) (*SubnetCollector, error)

func (*SubnetCollector) Collect

func (c *SubnetCollector) Collect(ctx context.Context, networkRange net.IPNet) ([]net.IPNet, error)

type SubnetCollectorConfig

type SubnetCollectorConfig struct {
	CtrlClient ctrlClient.Client
	Logger     micrologger.Logger

	NetworkRange net.IPNet
}

type TestChecker

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

func NewTestChecker

func NewTestChecker(proceed bool) *TestChecker

func (*TestChecker) Check

func (c *TestChecker) Check(ctx context.Context, namespace string, name string) (bool, error)

type TestCollector

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

func NewTestCollector

func NewTestCollector(subnets []net.IPNet) *TestCollector

func (*TestCollector) Collect

func (c *TestCollector) Collect(ctx context.Context, networkRange net.IPNet) ([]net.IPNet, error)

type TestPersister

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

func NewTestPersister

func NewTestPersister(subnet net.IPNet) *TestPersister

func (*TestPersister) Persist

func (p *TestPersister) Persist(ctx context.Context, subnet net.IPNet, namespace string, name string) error

Jump to

Keyboard shortcuts

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