nsmgr

package
v1.21.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NS added in v1.21.0

type NS interface {
	nspkg.NetNS
}

NS is a wrapper for the containernetworking plugin's NetNS interface It exists because while NetNS is specifically called such, it is really a generic namespace, and can be used for other namespace types.

type NSType

type NSType string

NSType is a representation of available namespace types.

const (
	NETNS                NSType = "net"
	IPCNS                NSType = "ipc"
	UTSNS                NSType = "uts"
	USERNS               NSType = "user"
	PIDNS                NSType = "pid"
	ManagedNamespacesNum        = 4
)

type Namespace added in v1.21.0

type Namespace interface {
	// Path returns the bind mount path of the namespace.
	Path() string

	// Type returns the namespace type (net, ipc, user, pid or uts).
	Type() NSType

	// Close ensures this namespace is closed.
	Close() error

	// Remove ensures this namespace is removed.
	Remove() error
}

Namespace provides a generic namespace interface.

func GetNamespace added in v1.21.0

func GetNamespace(nsPath string, nsType NSType) (Namespace, error)

GetNamespace takes a path and type, checks if it is a namespace, and if so returns an instance of the Namespace interface.

type NamespaceManager added in v1.21.0

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

NamespaceManager manages the server's namespaces. Specifically, it is an interface for how the server is creating namespaces, and can be requested to create namespaces for a pod.

func New added in v1.21.0

func New(namespacesDir, pinnsPath string) *NamespaceManager

New creates a new NamespaceManager.

func (*NamespaceManager) Initialize added in v1.21.0

func (mgr *NamespaceManager) Initialize() error

func (*NamespaceManager) NewPodNamespaces added in v1.21.0

func (mgr *NamespaceManager) NewPodNamespaces(cfg *PodNamespacesConfig) ([]Namespace, error)

NewPodNamespaces creates new namespaces for a pod. It's responsible for running pinns and creating the Namespace objects. The caller is responsible for cleaning up the namespaces by calling Namespace.Remove().

type PodNamespaceConfig added in v1.21.0

type PodNamespaceConfig struct {
	Type NSType
	Host bool
	Path string
}

type PodNamespacesConfig added in v1.21.0

type PodNamespacesConfig struct {
	Namespaces []*PodNamespaceConfig
	IDMappings *idtools.IDMappings
	Sysctls    map[string]string
}

Jump to

Keyboard shortcuts

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