Documentation ¶
Index ¶
- Variables
- type API
- type Config
- type Deps
- type NsPlugin
- func (p *NsPlugin) Close() error
- func (p *NsPlugin) GetNamespaceHandle(ctx nsLinuxcalls.NamespaceMgmtCtx, namespace *nsmodel.NetNamespace) (handle netns.NsHandle, err error)
- func (p *NsPlugin) Init() error
- func (p *NsPlugin) SwitchToNamespace(ctx nsLinuxcalls.NamespaceMgmtCtx, ns *nsmodel.NetNamespace) (revert func(), err error)
- type Option
Constants ¶
This section is empty.
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is a default instance of IfPlugin.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { // SwitchToNamespace switches the network namespace of the current thread. // Caller should eventually call the returned "revert" function in order to get back to the original // network namespace (for example using "defer revert()"). SwitchToNamespace(ctx linuxcalls.NamespaceMgmtCtx, ns *linux_namespace.NetNamespace) (revert func(), err error) // GetNamespaceHandle returns low-level run-time handle for the given namespace // to be used with Netlink API. Do not forget to eventually close the handle using // the netns.NsHandle.Close() method. GetNamespaceHandle(ctx linuxcalls.NamespaceMgmtCtx, ns *linux_namespace.NetNamespace) (handle netns.NsHandle, err error) }
API defines methods exposed by NsPlugin.
type Config ¶
type Config struct {
Disabled bool `json:"disabled"`
}
Config holds the nsplugin configuration.
type Deps ¶
type Deps struct { infra.PluginDeps KVScheduler kvs.KVScheduler }
Deps lists dependencies of the NsPlugin.
type NsPlugin ¶
type NsPlugin struct { Deps // contains filtered or unexported fields }
NsPlugin is a plugin to handle namespaces and microservices for other linux plugins (ifplugin, l3plugin ...). It does not follow the standard concept of CRUD, but provides a set of methods other plugins can use to manage namespaces.
func (*NsPlugin) GetNamespaceHandle ¶
func (p *NsPlugin) GetNamespaceHandle(ctx nsLinuxcalls.NamespaceMgmtCtx, namespace *nsmodel.NetNamespace) (handle netns.NsHandle, err error)
GetNamespaceHandle returns low-level run-time handle for the given namespace to be used with Netlink API. Do not forget to eventually close the handle using the netns.NsHandle.Close() method.
func (*NsPlugin) SwitchToNamespace ¶
func (p *NsPlugin) SwitchToNamespace(ctx nsLinuxcalls.NamespaceMgmtCtx, ns *nsmodel.NetNamespace) (revert func(), err error)
SwitchToNamespace switches the network namespace of the current thread. Caller should eventually call the returned "revert" function in order to get back to the original network namespace (for example using "defer revert()").
Directories ¶
Path | Synopsis |
---|---|
Package linuxcalls contains wrappers over Netlink & OS APIs related to Linux namespaces.
|
Package linuxcalls contains wrappers over Netlink & OS APIs related to Linux namespaces. |