package parent

import "github.com/rootless-containers/rootlesskit/v2/pkg/parent"

Index

Constants

const (
	SubidSourceAuto    = SubidSource("auto")    // Try dynamic then fallback to static
	SubidSourceDynamic = SubidSource("dynamic") // /usr/bin/getsubids
	SubidSourceStatic  = SubidSource("static")  // /etc/{subuid,subgid}
)
const (
	StateFileLock     = "lock"
	StateFileChildPID = "child_pid" // decimal pid number text
	StateFileAPISock  = "api.sock"  // REST API Socket
	StateFileNetNs    = "netns"     // rootlesskit network namespace
)

Documented state files. Undocumented ones are subject to change.

Functions

func InitStateDir

func InitStateDir(stateDir string) error

InitStateDir removes everything in the state dir except the lock file. This is needed because when the previous execution crashed, the state dir may not be removed successfully.

InitStateDir must be called before calling parent functions.

func LockStateDir

func LockStateDir(stateDir string) (*flock.Flock, error)

LockStateDir creates and locks "lock" file in the state dir.

func Parent

func Parent(opt Opt) error

Types

type Opt

type Opt struct {
	PipeFDEnvKey             string               // needs to be set
	ChildUseActivationEnvKey string               // needs to be set
	StateDir                 string               // directory needs to be precreated
	StateDirEnvKey           string               // optional env key to propagate StateDir value
	NetworkDriver            network.ParentDriver // nil for HostNetwork
	PortDriver               port.ParentDriver    // nil for --port-driver=none
	PublishPorts             []port.Spec
	CreatePIDNS              bool
	CreateCgroupNS           bool
	CreateUTSNS              bool
	CreateIPCNS              bool
	DetachNetNS              bool
	ParentEUIDEnvKey         string // optional env key to propagate geteuid() value
	ParentEGIDEnvKey         string // optional env key to propagate getegid() value
	Propagation              string
	EvacuateCgroup2          string // e.g. "rootlesskit_evacuation"
	SubidSource              SubidSource
}

type SubidSource

type SubidSource string

Source Files

parent.go warn.go

Directories

PathSynopsis
pkg/parent/cgrouputil
pkg/parent/dynidtools
pkg/parent/idtoolsPackage idtools is forked from https://github.com/moby/moby/tree/298ba5b13150bfffe8414922a951a7a793276d31/pkg/idtools
Version
v2.3.4 (latest)
Published
Mar 10, 2025
Platform
linux/amd64
Imports
26 packages
Last checked
3 weeks ago

Tools for package owners.