nsenter

package
v0.0.0-...-24370be Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 30

README

NSEnter

This package provides interfaces for executing and interacting with processes running within a namespace.

Documentation

Index

Constants

View Source
const (
	// DefaultHostRootFsPath is path to host's filesystem mounted into container
	// with kubelet.
	DefaultHostRootFsPath = "/rootfs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NSEnter

type NSEnter struct {
	// a map of commands to their paths on the host filesystem
	Paths map[string]string
}

NSEnter is part of experimental support for running the kubelet in a container.

func (*NSEnter) AbsHostPath

func (ne *NSEnter) AbsHostPath(command string) string

AbsHostPath returns the absolute runnable path for a specified command

func (*NSEnter) Command

func (ne *NSEnter) Command(cmd string, args ...string) exec.Cmd

Command returns a command wrapped with nenter

func (*NSEnter) CommandContext

func (ne *NSEnter) CommandContext(ctx context.Context, cmd string, args ...string) exec.Cmd

CommandContext returns a CommandContext wrapped with nsenter

func (*NSEnter) Exec

func (ne *NSEnter) Exec(cmd string, args []string) exec.Cmd

Exec executes nsenter commands in hostProcMountNsPath mount namespace

func (*NSEnter) LookPath

func (ne *NSEnter) LookPath(file string) (string, error)

LookPath returns a LookPath wrapped with nsenter

func (*NSEnter) SupportsSystemd

func (ne *NSEnter) SupportsSystemd() (string, bool)

SupportsSystemd checks whether command systemd-run exists

type Nsenter

type Nsenter = NSEnter

Nsenter is a type alias for backward compatibility

func NewNsenter

func NewNsenter(hostRootFsPath string, executor exec.Interface) (*Nsenter, error)

NewNsenter constructs a new instance of NSEnter

Jump to

Keyboard shortcuts

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