Documentation ¶
Overview ¶
Package netns defines and implements basic functions used to create and configure new network namespaces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNetns ¶
CreateNetns given a name it will check if a namespace exists with the given name and will remove it. Then the namespace will be recreated. To start fresh with a clean network namespace is preferred since we create a veth pair between network namespaces. If the namespace exists it means that our operator has crashed, better clean the namespace, because it's hard to check the existing configuration that spans multiple network namespaces. Returns a handler to the newly created network namespace or an error in case something goes wrong.
func CreateVethPair ¶
func CreateVethPair(originVethName, dstVethName string, originNetns, dstNetns ns.NetNS, linkMTU int) error
CreateVethPair it will create veth pair in originNetns and move one of them in dstNetns. originNetns is the host netns and dstNetns is the gateway netns. Error is returned if something goes wrong.
func DeleteNetns ¶
DeleteNetns removes a given network namespace by name. If the namespace does not exist does nothing, in case of error returns it.
Types ¶
This section is empty.