nodenet

package
v2.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayInfo

type GatewayInfo struct {
	Gateway  net.IP
	Networks []*net.IPNet
}

GatewayInfo is a set of destination networks for a gateway.

type PodNetConf

type PodNetConf struct {
	PoolName     string
	ContainerId  string
	IFace        string
	IPv4         net.IP
	IPv6         net.IP
	HostVethName string
}

PodNetConf holds configuration parameters for a Pod network

type PodNetwork

type PodNetwork interface {
	// Init initializes the host network.
	Init() error

	// Setup connects the host network and the container network with a veth pair.
	// `nsPath` is the container network namespace's (possibly bind-mounted) file.
	// If `hook` is non-nil, it is called in the Pod network.
	Setup(nsPath, podName, podNS string, conf *PodNetConf, hook SetupHook) (*current.Result, error)

	// Update updates the container network configuration
	// Currently, it only updates configuration using a SetupHook, e.g. NAT setting
	Update(podIPv4, podIPv6 net.IP, hook SetupHook) error

	// Check checks the pod network's status.
	Check(containerId, iface string) error

	// Destroy disconnects the container network by deleting the veth pair.
	// IPv4 and IPv6 in conf can be left nil.
	Destroy(containerId, iface string) error

	// List returns a list of already setup network configurations.
	List() ([]*PodNetConf, error)
}

PodNetwork represents an interface to configure container networking.

func NewPodNetwork

func NewPodNetwork(podTableID, podRulePrio, protocolId int, hostIPv4, hostIPv6 net.IP, compatCalico, registerFromMain bool, log logr.Logger) PodNetwork

NewPodNetwork creates a PodNetwork

type RouteExporter

type RouteExporter interface {
	Sync([]*net.IPNet) error
}

RouteExporter exports subnets to a Linux kernel routing table.

func NewRouteExporter

func NewRouteExporter(tableId, protocolId int, log logr.Logger) RouteExporter

NewRouteExporter creates a new RouteExporter

type RouteSyncer

type RouteSyncer interface {
	// Sync synchronizes the kernel routing table with the given routes.
	Sync([]GatewayInfo) error
}

RouteSyncer is the interface to program direct routing.

func NewRouteSyncer

func NewRouteSyncer(protocolId int, log logr.Logger) RouteSyncer

NewRouteSyncer creates a DirectRouter that marks routes with protocolId.

protocolId must be different from the ID for NewPodNetwork.

type SetupHook

type SetupHook func(ipv4, ipv6 net.IP) error

SetupHook is a signature of hook function for PodNetwork.Setup

Jump to

Keyboard shortcuts

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