Documentation ¶
Index ¶
Constants ¶
const ( // Default minimum time between secondary IP fetches DefaultMinRefreshInterval = 4 * time.Second // Default maximum time between secondary IP fetches DefaultMaxRefreshInterval = 1024 * time.Second )
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 ¶
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
Types ¶
type IPConsumer ¶ added in v1.6.14
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
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.