route

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client takes care of routing container packets in host network, coordinating ip route, ip rule, iptables and ipset.

func NewClient

func NewClient(serviceCIDR *net.IPNet, networkConfig *config.NetworkConfig, noSNAT bool) (*Client, error)

NewClient returns a route client. TODO: remove param serviceCIDR after kube-proxy is replaced by Antrea Proxy. This param is not used in this file; leaving it here is to be compatible with the implementation on Windows.

func (*Client) AddRoutes added in v0.5.0

func (c *Client) AddRoutes(podCIDR *net.IPNet, nodeIP, nodeGwIP net.IP) error

AddRoutes adds routes to a new podCIDR. It overrides the routes if they already exist.

func (*Client) DeleteRoutes added in v0.5.0

func (c *Client) DeleteRoutes(podCIDR *net.IPNet) error

DeleteRoutes deletes routes to a PodCIDR. It does nothing if the routes doesn't exist.

func (*Client) Initialize

func (c *Client) Initialize(nodeConfig *config.NodeConfig, done func()) error

Initialize initializes all infrastructures required to route container packets in host network. It is idempotent and can be safely called on every startup.

func (*Client) MigrateRoutesToGw added in v0.5.0

func (c *Client) MigrateRoutesToGw(linkName string) error

MigrateRoutesToGw moves routes (including assigned IP addresses if any) from link linkName to host gateway.

func (*Client) Reconcile added in v0.5.0

func (c *Client) Reconcile(podCIDRs []string) error

Reconcile removes orphaned podCIDRs from ipset and removes routes to orphaned podCIDRs based on the desired podCIDRs.

func (*Client) UnMigrateRoutesFromGw added in v0.5.0

func (c *Client) UnMigrateRoutesFromGw(route *net.IPNet, linkName string) error

UnMigrateRoutesFromGw moves route from gw to link linkName if provided; otherwise route is deleted

type Interface added in v0.5.0

type Interface interface {
	// Initialize should initialize all infrastructures required to route container packets in host network.
	// It should be idempotent and can be safely called on every startup.
	Initialize(nodeConfig *config.NodeConfig, done func()) error

	// Reconcile should remove orphaned routes and related configuration based on the desired podCIDRs. If IPv6 is enabled
	// in the cluster, Reconcile should also remove the orphaned IPv6 neighbors.
	Reconcile(podCIDRs []string) error

	// AddRoutes should add routes to the provided podCIDR.
	// It should override the routes if they already exist, without error.
	AddRoutes(podCIDR *net.IPNet, peerNodeIP, peerGwIP net.IP) error

	// DeleteRoutes should delete routes to the provided podCIDR.
	// It should do nothing if the routes don't exist, without error.
	DeleteRoutes(podCIDR *net.IPNet) error

	// MigrateRoutesToGw should move routes from device linkname to local gateway.
	MigrateRoutesToGw(linkName string) error

	// UnMigrateRoutesFromGw should move routes back from local gateway to original device linkName
	// if linkName is nil, it should remove the routes.
	UnMigrateRoutesFromGw(route *net.IPNet, linkName string) error
}

Interface is the interface for routing container packets in host network.

Directories

Path Synopsis
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.

Jump to

Keyboard shortcuts

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