Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamespacePathFromProc ¶ added in v1.23.0
NamespacePathFromProc returns the namespace path of type nsType for a given pid and type.
Types ¶
type NS ¶ added in v1.21.0
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 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 // Remove ensures this namespace is closed and removed. Remove() error }
Namespace provides a generic 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) NamespaceFromProcEntry ¶ added in v1.23.0
func (mgr *NamespaceManager) NamespaceFromProcEntry(pid int, nsType NSType) (_ Namespace, retErr error)
NamespaceFromProcEntry creates a new namespace object from a bind mount from a processes proc entry. The caller is responsible for cleaning up the namespace by calling Namespace.Remove(). This function is heavily based on containernetworking ns package found at: https://github.com/containernetworking/plugins/blob/5c3c17164270150467498a32c71436c7cd5501be/pkg/ns/ns.go#L140 Credit goes to the CNI authors.
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 PodNamespacesConfig ¶ added in v1.21.0
type PodNamespacesConfig struct { Namespaces []*PodNamespaceConfig IDMappings *idtools.IDMappings Sysctls map[string]string }