package stage0

import "github.com/coreos/rkt/stage0"

Index

Variables

var ValidOSArch = map[string][]string{
	"linux": {"amd64", "i386", "aarch64", "aarch64_be", "armv6l", "armv7l", "armv7b", "ppc64le"},
}

ValidOSArch contains the supported ACI image OS/architecture combinations.

Functions

func AddApp

func AddApp(cfg AddConfig) error

func Attach

func Attach(cdir string, podPID int, appName types.ACName, stage1Path string, uuid string, args []string) error

Attach runs attach entrypoint, crossing the stage0/stage1 border.

func CheckMdsAvailability

func CheckMdsAvailability() error

CheckMdsAvailability checks whether a local metadata service can be reached.

func Enter

func Enter(cdir string, podPID int, appName types.ACName, stage1Path string, cmdline []string) error

Enter enters the pod/app by exec()ing the stage1's /enter similar to /init /enter can expect to have its CWD set to the app root. appName and command are supplied to /enter on argv followed by any arguments. stage1Path is the path of the stage1 rootfs

func GC

func GC(pdir string, uuid *types.UUID, localConfig string) error

GC enters the pod by fork/exec()ing the stage1's /gc similar to /init. /gc can expect to have its CWD set to the pod root.

func InitDebug

func InitDebug()

InitDebug enables debugging

func MergeMounts

func MergeMounts(mounts []schema.Mount, appMounts []schema.Mount) []schema.Mount

MergeMounts combines the global and per-app mount slices

func MountGC

func MountGC(path, uuid string) error

MountGC removes mounts from pods that couldn't be GCed cleanly.

func Prepare

func Prepare(cfg PrepareConfig, dir string, uuid *types.UUID) error

Prepare sets up a pod based on the given config.

func RmApp

func RmApp(cfg RmConfig) error

func Run

func Run(cfg RunConfig, dir string, dataDir string)

Run mounts the right overlay filesystems and actually runs the prepared pod by exec()ing the stage1 init inside the pod filesystem.

func StartApp

func StartApp(cfg StartConfig) error

func StopApp

func StopApp(cfg StopConfig) error

func StopPod

func StopPod(dir string, force bool, uuid *types.UUID) error

StopPod stops the given pod.

Types

type AddConfig

type AddConfig struct {
	*CommonConfig
	Image                types.Hash
	Apps                 *apps.Apps
	RktGid               int
	UsesOverlay          bool
	PodPath              string
	PodPID               int
	InsecureCapabilities bool
	InsecurePaths        bool
	InsecureSeccomp      bool
}

type CommonConfig

type CommonConfig struct {
	DataDir      string                        // The path to the data directory, e.g. /var/lib/rkt/pods
	Store        *imagestore.Store             // store containing all of the configured application images
	TreeStore    *treestore.Store              // store containing all of the configured application images
	Stage1Image  types.Hash                    // stage1 image containing usable /init and /enter entrypoints
	UUID         *types.UUID                   // UUID of the pod
	RootHash     string                        // hash of the root filesystem
	ManifestData string                        // the pod manifest data
	Debug        bool                          // debug mode
	MountLabel   string                        // SELinux label to use for fs
	ProcessLabel string                        // SELinux label to use
	Mutable      bool                          // whether this pod is mutable
	Annotations  map[types.ACIdentifier]string // pod-level annotations, for internal/experimental usage
}

CommonConfig defines the configuration shared by both Run and Prepare

type CrossingEntrypoint

type CrossingEntrypoint struct {
	PodPath        string
	PodPID         int
	AppName        string
	EntrypointName string
	EntrypointArgs []string
	Interactive    bool
}

CrossingEntrypoint represents a stage1 entrypoint whose execution needs to cross the stage0/stage1/stage2 boundary.

func (CrossingEntrypoint) Run

func (ce CrossingEntrypoint) Run() error

Run wraps the execution of a stage1 entrypoint which requires crossing the stage0/stage1/stage2 boundary during its execution, by setting up proper environment variables for enter.

type DNSConfMode

type DNSConfMode struct {
	Resolv string // /etc/rkt-resolv.conf
	Hosts  string // /etc/rkt-hosts
}

DNSConfMode indicates what the stage1 should do with dns config files The values and meanings are: 'host': bind-mount from host 'stage0': the stage0 has generated it 'none' : do not generate it 'default' : do whatever was the default

type HostsEntries

type HostsEntries map[string][]string

HostsEntries encapsulates the entries in an etc-hosts file: mapping from IP to arbitrary list of hostnames

type PrepareConfig

type PrepareConfig struct {
	*CommonConfig
	Apps            *apps.Apps            // apps to prepare
	InheritEnv      bool                  // inherit parent environment into apps
	ExplicitEnv     []string              // always set these environment variables for all the apps
	EnvFromFile     []string              // environment variables loaded from files, set for all the apps
	Ports           []types.ExposedPort   // list of ports that rkt will expose on the host
	UseOverlay      bool                  // prepare pod with overlay fs
	PodManifest     string                // use the pod manifest specified by the user, this will ignore flags such as '--volume', '--port', etc.
	PrivateUsers    *user.UidRange        // user namespaces
	UserAnnotations types.UserAnnotations // user annotations for the pod.
	UserLabels      types.UserLabels      // user labels for the pod.
}

PrepareConfig defines the configuration parameters required by Prepare

type RmConfig

type RmConfig struct {
	*CommonConfig
	PodPath     string
	UsesOverlay bool
	AppName     *types.ACName
	PodPID      int
}

type RunConfig

type RunConfig struct {
	*CommonConfig
	Net                  common.NetList // pod should have its own network stack
	LockFd               int            // lock file descriptor
	Interactive          bool           // whether the pod is interactive or not
	MDSRegister          bool           // whether to register with metadata service or not
	Apps                 schema.AppList // applications (prepare gets them via Apps)
	LocalConfig          string         // Path to local configuration
	Hostname             string         // hostname of the pod
	RktGid               int            // group id of the 'rkt' group, -1 ere's no rkt group.
	DNSConfMode          DNSConfMode    // dns configuration file mode - for stAage1
	DNSConfig            cnitypes.DNS   // the DNS configuration (nameservers, search, options)
	InsecureCapabilities bool           // Do not restrict capabilities
	InsecurePaths        bool           // Do not restrict access to files in sysfs or procfs
	InsecureSeccomp      bool           // Do not add seccomp restrictions
	UseOverlay           bool           // run pod with overlay fs
	HostsEntries         HostsEntries   // The entries in /etc/hosts
	IPCMode              string         // whether to stay in the host IPC namespace
}

RunConfig defines the configuration parameters needed by Run

type StartConfig

type StartConfig struct {
	*CommonConfig
	PodPath     string
	UsesOverlay bool
	AppName     *types.ACName
	PodPID      int
}

type StopConfig

type StopConfig struct {
	*CommonConfig
	PodPath string
	AppName *types.ACName
	PodPID  int
}

Source Files

app_add.go app_rm.go app_start.go app_stop.go arch.go attach.go common.go enter.go gc.go log.go manifest.go registration.go run.go stop.go

Version
v1.30.0 (latest)
Published
Apr 13, 2018
Platform
linux/amd64
Imports
38 packages
Last checked
7 hours ago

Tools for package owners.