nodesubnet

package
v1.6.14 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default minimum time between secondary IP fetches
	DefaultMinRefreshInterval = 4 * time.Second
	// Default maximum time between secondary IP fetches
	DefaultMaxRefreshInterval = 1024 * time.Second
)
View Source
const (
	// ID for fake NC that we create to store NodeSubnet IPS
	NodeSubnetNCID          = "55022629-3854-499b-7133-5e6887959f4ea" // md5sum of "NodeSubnetNC_IPv4"
	NodeSubnetNCVersion     = 0
	NodeSubnetHostVersion   = "0"
	NodeSubnetNCStatus      = v1alpha.NCUpdateSuccess
	NodeSubnetHostPrimaryIP = ""
)

Variables

View Source
var ErrRefreshSkipped = errors.New("refresh skipped due to throttling")

Functions

func CreateNodeSubnetNCRequest added in v1.6.14

func CreateNodeSubnetNCRequest(secondaryIPs []string) *cns.CreateNetworkContainerRequest

CreateNodeSubnetNCRequest generates a CreateNetworkContainerRequest that simply stores the static secondary IPs.

func ReconcileInitialCNSState added in v1.6.14

func ReconcileInitialCNSState(_ context.Context, ipamReconciler ipamReconciler, podInfoByIPProvider cns.PodInfoByIPProvider) (int, error)

Types

type IPConsumer added in v1.6.14

type IPConsumer interface {
	UpdateIPsForNodeSubnet([]netip.Addr) error
}

IPConsumer is an interface implemented by whoever consumes the secondary IPs fetched in nodesubnet

type IPFetcher

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

IPFetcher fetches secondary IPs from NMAgent at regular intervals. The interval will vary within the range of minRefreshInterval and maxRefreshInterval. When no diff is observed after a fetch, the interval doubles (subject to the maximum interval). When a diff is observed, the interval resets to the minimum.

func NewIPFetcher

func NewIPFetcher(
	client InterfaceRetriever,
	consumer IPConsumer,
	minInterval time.Duration,
	maxInterval time.Duration,
	logger refresh.Logger,
) *IPFetcher

NewIPFetcher creates a new IPFetcher. If minInterval is 0, it will default to 4 seconds. If maxInterval is 0, it will default to 1024 seconds (or minInterval, if it is higher).

func (*IPFetcher) ProcessInterfaces added in v1.6.14

func (c *IPFetcher) ProcessInterfaces(response nmagent.Interfaces) error

Fetch IPs from NMAgent and pass to the consumer

func (*IPFetcher) Start added in v1.6.14

func (c *IPFetcher) Start(ctx context.Context)

Start the IPFetcher.

type InterfaceRetriever

type InterfaceRetriever interface {
	GetInterfaceIPInfo(ctx context.Context) (nmagent.Interfaces, error)
}

InterfaceRetriever is an interface is implemented by the NMAgent Client, and also a mock client for testing.

Jump to

Keyboard shortcuts

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