route

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlatNetworkRouteToHost

func AddFlatNetworkRouteToHost(
	podNS ns.NetNS, flatNetworkIP net.IP, master string,
) error

AddFlatNetworkRouteToHost adds flatNetworkIP route to native CNI iface on host NS

Example: ip route add <FLAT_NETWORK_IP> dev <NATIVE_CNI_IFACE> src <HOST_IP>

func AddPodFlatNetworkCustomRoutes

func AddPodFlatNetworkCustomRoutes(podNS ns.NetNS, customRoutes []flv1.Route) error

AddPodFlatNetworkCustomRoutes adds user defined custom routes and host IP routes to pod NS

func AddPodNodeCIDRRoutes

func AddPodNodeCIDRRoutes(podNS ns.NetNS) error

func CheckRouteExists

func CheckRouteExists(
	route *netlink.Route,
) (bool, error)

CheckRouteExists checks whether the route exists by route dst

func DelFlatNetworkRouteFromHost

func DelFlatNetworkRouteFromHost(flatNetworkIP net.IP) error

DelFlatNetworkRouteFromHost remove flatNetworkIP route from native CNI iface on host NS

Example: ip route del <FLAT_NETWORK_IP>

func EnsureRouteExists

func EnsureRouteExists(
	route *netlink.Route,
) error

EnsureRouteExists adds route if not exists

func GetDefaultRoutes

func GetDefaultRoutes() ([]netlink.Route, error)

GetDefaultRoute gets default route NOTE: will return nil if no route found

func GetRouteByIP

func GetRouteByIP(ip net.IP) (*netlink.Route, error)

GetRouteByIP executes 'ip route get <IP>' on host network NS. NOTE: will return nil if no route found

func UpdatePodDefaultGateway

func UpdatePodDefaultGateway(
	podNS ns.NetNS, ifName string, flatNetworkIP net.IP, gateway net.IP,
) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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