Documentation ¶
Overview ¶
Package common defines values shared by different parts of rkt (e.g. stage0 and stage1)
Index ¶
- Constants
- func AppCreatedPath(root, appName string) string
- func AppCreatedPathFromStage1Rootfs(rootfs, appName string) string
- func AppImageManifestPath(root string, appName types.ACName) string
- func AppInfoPath(root string, appName types.ACName) string
- func AppPath(root string, appName types.ACName) string
- func AppRootfsPath(root string, appName types.ACName) string
- func AppStartedPath(root, appName string) string
- func AppStartedPathFromStage1Rootfs(rootfs, appName string) string
- func AppStatusPath(root, appName string) string
- func AppStatusPathFromStage1Rootfs(rootfs, appName string) string
- func AppTreeStoreIDPath(root string, appName types.ACName) string
- func AppsInfoPath(root string) string
- func AppsPath(root string) string
- func AppsStatusesPath(root string) string
- func AppsStatusesPathFromStage1Rootfs(rootfs string) string
- func ChrootPrivateUnmount(targetPath string, log *rktlog.Logger, diagf func(string, ...interface{})) error
- func ComposeEnviron(env types.Environment) []string
- func CreateSharedVolumesPath(root string) (string, error)
- func GetArch() string
- func GetExitStatus(err error) (int, error)
- func GetOS() string
- func GetOSArch() (os string, arch string)
- func GetRktLockFD() (int, error)
- func ImageManifestPath(root string, appName types.ACName) string
- func ImageNameToAppName(name types.ACIdentifier) (*types.ACName, error)
- func IsDNSZero(dns *cnitypes.DNS) bool
- func IsExperimentEnabled(name string) bool
- func LookupGid(groupName string) (gid int, err error)
- func LookupPath(bin string, paths string) (string, error)
- func MakeResolvConf(dns cnitypes.DNS, comment string) string
- func MetadataServicePublicURL(ip net.IP, token string) string
- func PathSupportsOverlay(path string) error
- func PodCreatedPath(root string) string
- func PodManifestLockPath(root string) string
- func PodManifestPath(root string) string
- func ReadEnvFileRaw(envFilePath string) ([]string, error)
- func RelAppPath(appName types.ACName) string
- func RelAppRootfsPath(appName types.ACName) string
- func RemoveEmptyLines(str string) []string
- func SharedVolumesPath(root string) string
- func SliceToPath(unit string) (string, error)
- func Stage1ImagePath(root string) string
- func Stage1ManifestPath(root string) string
- func Stage1RootfsPath(root string) string
- func SupportsOverlay() error
- func SupportsUserNS() bool
- func SystemdVersion(systemdBinaryPath string) (int, error)
- func WriteEnvFile(env []string, uidRange *user.UidRange, envFilePath string) error
- type ErrOverlayUnsupported
- type NetList
- func (l *NetList) All() bool
- func (l *NetList) Contained() bool
- func (l *NetList) Host() bool
- func (l *NetList) None() bool
- func (l *NetList) Set(value string) error
- func (l *NetList) Specific(net string) bool
- func (l *NetList) SpecificArgs(net string) string
- func (l *NetList) String() string
- func (l *NetList) Strings() []string
- func (l *NetList) StringsOnlyNames() (list []string)
- func (l *NetList) Type() string
Constants ¶
const ( AppsInfoDir = "/appsinfo" EnvLockFd = "RKT_LOCK_FD" EnvSELinuxContext = "RKT_SELINUX_CONTEXT" EnvSELinuxMountContext = "RKT_SELINUX_MOUNT_CONTEXT" Stage1TreeStoreIDFilename = "stage1TreeStoreID" AppTreeStoreIDFilename = "treeStoreID" OverlayPreparedFilename = "overlay-prepared" PrivateUsersPreparedFilename = "private-users-prepared" PrepareLock = "prepareLock" MetadataServicePort = 18112 MetadataServiceRegSock = "/run/rkt/metadata-svc.sock" APIServiceListenAddr = "localhost:15441" DefaultLocalConfigDir = "/etc/rkt" DefaultSystemConfigDir = "/usr/lib/rkt" // Default perm bits for the regular files // within the stage1 directory. (e.g. image manifest, // pod manifest, stage1ID, etc). DefaultRegularFilePerm = os.FileMode(0640) // Default perm bits for the regular directories // within the stage1 directory. DefaultRegularDirPerm = os.FileMode(0750) // Enter command for crossing entrypoints. CrossingEnterCmd = "RKT_STAGE1_ENTERCMD" // Stage1 (PID) to enter, used by crossing entrypoints. CrossingEnterPID = "RKT_STAGE1_ENTERPID" // Stage2 (application name) to enter, optionally used by crossing entrypoints. CrossingEnterApp = "RKT_STAGE1_ENTERAPP" )
const ( FsMagicAUFS = 0x61756673 // https://goo.gl/CBwx43 FsMagicZFS = 0x2FC12FC1 // https://goo.gl/xTvzO5 )
const ( RktGroup = "rkt" // owns /var/lib/rkt RktAdminGroup = "rkt-admin" // owns /etc/rkt )
const DefaultPath = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Variables ¶
This section is empty.
Functions ¶
func AppCreatedPath ¶ added in v1.16.0
AppCreatedPath returns the path of the ${appname}-created file, which is used to record the creation timestamp of the app.
func AppCreatedPathFromStage1Rootfs ¶ added in v1.29.0
AppCreatedPathFromStage1Rootfs returns the path of the ${appname}-created file, which is used to record the creation timestamp of the app. It receives the stage1 rootfs as parameter instead of the pod root.
func AppImageManifestPath ¶ added in v0.15.0
AppImageManifestPath returns the path to the app's ImageManifest file
func AppInfoPath ¶ added in v0.9.0
AppInfoPath returns the path to the app's appsinfo directory of a pod.
func AppRootfsPath ¶
AppRootfsPath returns the path to an app's rootfs.
func AppStartedPath ¶ added in v1.16.0
AppStartedPath returns the path of the ${appname}-started file, which is used to record the start timestamp of the app.
func AppStartedPathFromStage1Rootfs ¶ added in v1.29.0
AppStartedPathFromStage1Rootfs returns the path of the ${appname}-started file, which is used to record the start timestamp of the app. It receives the stage1 rootfs as parameter instead of the pod root.
func AppStatusPath ¶ added in v1.16.0
AppStatusPath returns the path of the status file of an app.
func AppStatusPathFromStage1Rootfs ¶ added in v1.29.0
AppStatusPathFromStage1Rootfs returns the path of the status file of an app. It receives the stage1 rootfs as parameter instead of the pod root.
func AppTreeStoreIDPath ¶ added in v0.9.0
AppTreeStoreIDPath returns the path to the app's treeStoreID file of a pod.
func AppsInfoPath ¶ added in v0.9.0
AppsInfoPath returns the path to the appsinfo directory of a pod.
func AppsStatusesPath ¶ added in v1.16.0
AppsStatusesPath returns the path of the status dir for all apps.
func AppsStatusesPathFromStage1Rootfs ¶ added in v1.29.0
AppsStatusesPathFromStage1Rootfs returns the path of the status dir for all apps. It receives the stage1 rootfs as parameter instead of the pod root.
func ChrootPrivateUnmount ¶ added in v1.22.0
func ChrootPrivateUnmount(targetPath string, log *rktlog.Logger, diagf func(string, ...interface{})) error
ChrootPrivateUnmount cleans up in a safe way all mountpoints existing under `targetPath`. This requires multiple steps:
- take handles to the current rootdir and workdir (to restore at the end)
- parse /proc/self/mountinfo to get a list of all mount targets, and filter out those outside of targetPath
- chroot into target path, so that all mounts and symlinks can be properly de-referenced as they appear inside the rootfs
- mark all mounts as private, so that further operations are not propagated outside of this rootfs - in descending nest order (parent first)
- unmount all mount targets - in ascending nest order (children first). If unmount fails, lazy-detach the mount target so that the kernel can still clean it up once it ceases to be busy
- chdir and chroot back to the original state
func ComposeEnviron ¶ added in v1.28.0
func ComposeEnviron(env types.Environment) []string
ComposeEnviron formats the environment into a slice of strings, each of the form "key=value". The minimum required environment variables by the appc spec will be set to sensible defaults here if they're not provided by env.
func CreateSharedVolumesPath ¶ added in v1.22.0
CreateSharedVolumesPath ensures the sharedVolumePath for the pod root passed in exists. It returns the shared volume path or an error.
func GetExitStatus ¶ added in v1.19.0
GetExitStatus converts an error to an exit status. If it wasn't an exit status != 0 it returns the same error that it was called with
func GetOS ¶ added in v1.26.0
func GetOS() string
GetOS returns the current ACI operating system (linux, windows etc...)
func GetRktLockFD ¶ added in v0.5.1
func ImageManifestPath ¶
ImageManifestPath returns the path to the app's manifest file of a pod.
func ImageNameToAppName ¶ added in v1.29.0
func ImageNameToAppName(name types.ACIdentifier) (*types.ACName, error)
ImageNameToAppName converts the full name of image to an app name without special characters - we use it as a default app name when specyfing it is optional
func IsDNSZero ¶ added in v1.15.0
- TODO(cdc) move this to cnitypes
IsDNSZero checks if the DNS configuration has any information
func IsExperimentEnabled ¶ added in v1.19.0
IsExperimentEnabled returns true if the given rkt experiment is enabled. The given name is converted to upper case and a bool RKT_EXPERIMENT_{NAME} environment variable is retrieved. If the experiment name is unknown, false is returned. If the environment variable does not contain a valid bool value according to strconv.ParseBool, false is returned.
func LookupGid ¶ added in v0.9.0
LookupGid reads the group file and returns the gid of the group specified by groupName.
func LookupPath ¶ added in v1.1.0
LookupPath search for bin in paths. If found, it returns its absolute path, if not, an error
func MakeResolvConf ¶ added in v1.15.0
MakeResolvConf generates resolv.conf contents given a cni DNS configuration
func MetadataServicePublicURL ¶ added in v0.4.0
MetadataServicePublicURL returns the public URL used to host the metadata service
func PathSupportsOverlay ¶ added in v1.14.0
PathSupportsOverlay checks whether the given path is compatible with OverlayFS. This method also calls SupportsOverlay().
It returns an instance of ErrOverlayUnsupported if OverlayFS is not supported or any other error if determining overlay support failed.
func PodCreatedPath ¶ added in v1.21.0
PodCreatedPath returns the path in root to the Pod Created file used to denote the time of creation.
func PodManifestLockPath ¶ added in v1.19.0
PodManifestLockPath returns the path in root to the Pod Manifest lock file. This must be different from the PodManifestPath since mutations on the pod manifest file happen by overwriting the original file.
func PodManifestPath ¶ added in v0.5.1
PodManifestPath returns the path in root to the Pod Manifest
func ReadEnvFileRaw ¶ added in v1.28.0
ReadEnvFileRaw reads the environment file, returning it as a slice of strings, each expected but not checked to be of the form "key=value". (The suffix leaves room for a function which parallels WriteEnvFile, which splits each string and has a return type of types.Environment.)
func RelAppPath ¶ added in v0.8.0
RelAppPath returns the path of an app relative to the stage1 chroot.
func RelAppRootfsPath ¶
RelAppRootfsPath returns the path of an app's rootfs relative to the stage1 chroot.
func RemoveEmptyLines ¶ added in v1.12.0
RemoveEmptyLines removes empty lines from the given string and breaks it up into a list of strings at newline characters
func SharedVolumesPath ¶ added in v0.9.0
SharedVolumesPath returns the path to the shared (empty) volumes of a pod.
func SliceToPath ¶ added in v0.6.1
SliceToPath explodes a slice name to its corresponding path in the cgroup hierarchy. For example, a slice named "foo-bar-baz.slice" corresponds to the path "foo.slice/foo-bar.slice/foo-bar-baz.slice". See systemd.slice(5)
func Stage1ImagePath ¶
Stage1ImagePath returns the path where the stage1 app image (unpacked ACI) is rooted, (i.e. where its contents are extracted during stage0).
func Stage1ManifestPath ¶
Stage1ManifestPath returns the path to the stage1's manifest file inside the expanded ACI.
func Stage1RootfsPath ¶
Stage1RootfsPath returns the path to the stage1 rootfs
func SupportsOverlay ¶ added in v0.5.2
func SupportsOverlay() error
SupportsOverlay returns whether the operating system generally supports OverlayFS, returning an instance of ErrOverlayUnsupported which encodes the reason. It is sufficient to check for nil if the reason is not of interest.
func SupportsUserNS ¶ added in v0.8.0
func SupportsUserNS() bool
SupportsUserNS returns whether the kernel has CONFIG_USER_NS set
func SystemdVersion ¶ added in v1.1.0
SystemdVersion parses and returns the version of a given systemd binary
func WriteEnvFile ¶ added in v1.16.0
WriteEnvFile creates an environment file for given app name. To ensure the minimum required environment variables by the appc spec are set to sensible defaults, env should be the result of calling ComposeEnviron. The containing directory and its ancestors will be created if necessary.
Types ¶
type ErrOverlayUnsupported ¶ added in v1.14.0
type ErrOverlayUnsupported string
ErrOverlayUnsupported is the error determining whether OverlayFS is supported.
func (ErrOverlayUnsupported) Error ¶ added in v1.14.0
func (e ErrOverlayUnsupported) Error() string
type NetList ¶ added in v0.9.0
type NetList struct {
// contains filtered or unexported fields
}
NetList implements the flag.Value interface to allow specification of --net with and without values Example: --net="all,net1:k1=v1;k2=v2,net2:l1=w1"
func (*NetList) Contained ¶ added in v0.10.0
Check if the container needs to be put in a separate network namespace
func (*NetList) None ¶ added in v0.10.0
Check if 'none' (loopback only) networking has been requested