ipam

package
v8.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 16 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 {
	G8sClient versioned.Interface
	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 {
	G8sClient versioned.Interface
	Logger    micrologger.Logger
}

type Collector

type Collector interface {
	Collect(ctx context.Context) ([]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.

type Config

type Config struct {
	Checker   Checker
	Collector Collector
	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 {
	G8sClient versioned.Interface
	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 {
	G8sClient versioned.Interface
	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) ([]net.IPNet, error)

type SubnetCollectorConfig

type SubnetCollectorConfig struct {
	G8sClient versioned.Interface
	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) ([]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