neighbor

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cell = cell.Module(
	"neighbor",
	"Neighbor subsystem",

	ForwardableIPCell,

	cell.Config(neighborConfig{EnableL2NeighDiscovery: false}),
	cell.ProvidePrivate(newCommonConfig),

	cell.ProvidePrivate(newDesiredNeighborTable),
	cell.Provide(statedb.RWTable[*DesiredNeighbor].ToTable),

	cell.ProvidePrivate(newNetlinkFuncsGetter),

	cell.Invoke(newDesiredNeighborCalculator),

	cell.ProvidePrivate(newOps),

	cell.Invoke(newNeighborReconciler),

	cell.Invoke(newNeighborRefresher),

	metrics.Metric(NewNeighborMetrics),
)
View Source
var (
	DesiredNeighborIndex = statedb.Index[*DesiredNeighbor, DesiredNeighborKey]{
		Name: "id",
		FromObject: func(d *DesiredNeighbor) index.KeySet {
			return index.NewKeySet(d.TableKey())
		},
		FromKey:    DesiredNeighborKey.TableKey,
		FromString: desiredNeighborKeyFromString,
		Unique:     true,
	}
)
View Source
var ForwardableIPCell = cell.Group(

	cell.Provide(newForwardableIPTable),
)

This is a separate cell so it can be included independently in tests to assert against the contents of the forwardable IP table without having to include the entire neighbor subsystem.

View Source
var (
	ForwardableIPIndex = statedb.Index[*ForwardableIP, netip.Addr]{
		Name: "id",
		FromObject: func(d *ForwardableIP) index.KeySet {
			return index.NewKeySet(index.NetIPAddr(d.IP))
		},
		FromKey:    index.NetIPAddr,
		FromString: index.NetIPAddrString,
		Unique:     true,
	}
)

Functions

func NewCommonTestConfig

func NewCommonTestConfig(
	enableL2NeighDiscovery bool,
	arpPingKernelManaged bool,
) func() *CommonConfig

NewCommonTestConfig returns a function that creates a commonConfig with the specified parameters.

func NewNeighborMetrics

func NewNeighborMetrics() *neighborMetrics

Types

type CommonConfig

type CommonConfig struct {
	Enabled              bool
	ARPPingKernelManaged func() error
}

type DesiredNeighbor

type DesiredNeighbor struct {
	DesiredNeighborKey

	Status reconciler.Status
}

func (*DesiredNeighbor) Clone

func (dn *DesiredNeighbor) Clone() *DesiredNeighbor

func (*DesiredNeighbor) GetStatus

func (dn *DesiredNeighbor) GetStatus() reconciler.Status

func (*DesiredNeighbor) SetStatus

func (dn *DesiredNeighbor) SetStatus(status reconciler.Status) *DesiredNeighbor

func (*DesiredNeighbor) TableHeader

func (dn *DesiredNeighbor) TableHeader() []string

func (*DesiredNeighbor) TableRow

func (dn *DesiredNeighbor) TableRow() []string

type DesiredNeighborKey

type DesiredNeighborKey struct {
	IP      netip.Addr
	IfIndex int
}

func (*DesiredNeighborKey) String

func (dn *DesiredNeighborKey) String() string

func (DesiredNeighborKey) TableKey

func (dn DesiredNeighborKey) TableKey() index.Key

type ForwardableIP

type ForwardableIP struct {
	IP     netip.Addr
	Owners []ForwardableIPOwner
}

func (*ForwardableIP) TableHeader

func (fip *ForwardableIP) TableHeader() []string

func (*ForwardableIP) TableRow

func (fip *ForwardableIP) TableRow() []string

type ForwardableIPInitializer

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

type ForwardableIPManager

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

ForwardableIPManager manages modification of the ForwardableIP table. It abstracts away the logic that tracks multiple owners of the same IP.

func (*ForwardableIPManager) Delete

func (fim *ForwardableIPManager) Delete(ip netip.Addr, owner ForwardableIPOwner) error

Delete removes and IP from the table for a given owner. If an IP has multiple owners, the given owner is removed from the list of owners. If the last owner is removed, the IP is deleted from the table.

func (*ForwardableIPManager) Enabled

func (fim *ForwardableIPManager) Enabled() bool

func (*ForwardableIPManager) FinishInitializer

func (fim *ForwardableIPManager) FinishInitializer(initializer ForwardableIPInitializer)

Mark an initializer as finished.

func (*ForwardableIPManager) Insert

func (fim *ForwardableIPManager) Insert(ip netip.Addr, owner ForwardableIPOwner) error

Insert a forwardable IP into the table for a given owner. If the IP already exists, the owner is added to the existing entry.

func (*ForwardableIPManager) RegisterInitializer

func (fim *ForwardableIPManager) RegisterInitializer(name string) ForwardableIPInitializer

RegisterInitializer registers an initializer for the ForwardableIP table. This has to be done during the hive construction phase. An initializer will guarantee that the forwardable IP table is not considered "initialized" until the initializer is finished.

type ForwardableIPOwner

type ForwardableIPOwner struct {
	Type ForwardableIPOwnerType
	ID   string
}

func (ForwardableIPOwner) String

func (fip ForwardableIPOwner) String() string

type ForwardableIPOwnerType

type ForwardableIPOwnerType int
const (
	ForwardableIPOwnerNode ForwardableIPOwnerType = iota
	ForwardableIPOwnerService
)

func (ForwardableIPOwnerType) String

func (fip ForwardableIPOwnerType) String() string

func (*ForwardableIPOwnerType) UnmarshalYAML

func (fip *ForwardableIPOwnerType) UnmarshalYAML(unmarshal *yaml.Node) (err error)

Jump to

Keyboard shortcuts

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