Documentation ¶
Index ¶
- Constants
- Variables
- func AddPrivilegedDevices(g *generate.Generator, systemdMode bool) error
- func ConvertTimeout(timeout int) uint
- func CoresToPeriodAndQuota(cores float64) (uint64, int64)
- func CreateIDFile(path string, id string) error
- func DefaultContainerConfig() *config.Config
- func DeviceFromPath(path string) (*spec.LinuxDevice, error)
- func ExecAddTERM(existingEnv []string, execEnvs map[string]string)
- func ExitCode(err error) int
- func FiltersFromRequest(r *http.Request) ([]string, error)
- func FindDeviceNodes() (map[string]string, error)
- func GetContainerPidInformationDescriptors() ([]string, error)
- func GetIdentityPath(name string) string
- func GetKeepIDMapping(opts *namespaces.KeepIDUserNsOptions) (*stypes.IDMappingOptions, int, int, error)
- func GetNoMapMapping() (*stypes.IDMappingOptions, int, int, error)
- func GetRootlessConfigHomeDir() (string, error)
- func GetRootlessPauseProcessPidPath() (string, error)
- func GetRuntimeDir() (string, error)
- func IDtoolsToRuntimeSpec(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxIDMapping)
- func IndexOfStringInSlice(s string, sl []string) int
- func LookupUser(name string) (*user.User, error)
- func OpenExclusiveFile(path string) (*os.File, error)
- func ParseDockerignore(containerfiles []string, root string) ([]string, string, error)
- func ParseDriverOpts(option string) (string, string, error)
- func ParseIDMap(mapSpec []string, mapSetting string, parentMapping []ruser.IDMap) (idmap []idtools.IDMap, err error)
- func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, ...) (*stypes.IDMappingOptions, error)
- func ParseInputTime(inputTime string, since bool) (time.Time, error)
- func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error)
- func ParseRestartPolicy(policy string) (string, uint, error)
- func ParseSignal(rawSignal string) (syscall.Signal, error)
- func PeriodAndQuotaToCores(period uint64, quota int64) float64
- func PrepareFilters(r *http.Request) (*map[string][]string, error)
- func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string, error)
- func RuntimeSpecToIDtools(idMaps []specs.LinuxIDMapping) (convertedIDMap []idtools.IDMap)
- func SizeOfPath(path string) (uint64, error)
- func StringInSlice(s string, sl []string) bool
- func StringMatchRegexSlice(s string, re []string) bool
- func Tmpdir() string
- func ValidateSysctls(strSlice []string) (map[string]string, error)
- func WriteStorageConfigFile(storageOpts *stypes.StoreOptions, storageConf string) error
Constants ¶
const ( // Kube annotation for podman volume driver. VolumeDriverAnnotation = "volume.podman.io/driver" // Kube annotation for podman volume type. VolumeTypeAnnotation = "volume.podman.io/type" // Kube annotation for podman volume device. VolumeDeviceAnnotation = "volume.podman.io/device" // Kube annotation for podman volume UID. VolumeUIDAnnotation = "volume.podman.io/uid" // Kube annotation for podman volume GID. VolumeGIDAnnotation = "volume.podman.io/gid" // Kube annotation for podman volume mount options. VolumeMountOptsAnnotation = "volume.podman.io/mount-options" // Kube annotation for podman volume import source. VolumeImportSourceAnnotation = "volume.podman.io/import-source" )
const DefaultCPUPeriod uint64 = 100000
DefaultCPUPeriod is the default CPU period (100ms) in microseconds, which is the same default as Kubernetes.
Variables ¶
var ( // ErrBadMntOption indicates that an invalid mount option was passed. ErrBadMntOption = errors.New("invalid mount option") // ErrDupeMntOption indicates that a duplicate mount option was passed. ErrDupeMntOption = errors.New("duplicate mount option passed") )
Functions ¶
func AddPrivilegedDevices ¶ added in v4.2.0
func ConvertTimeout ¶ added in v4.7.0
ConvertTimeout converts negative timeout to MaxInt, which indicates approximately infinity, waiting to stop containers
func CoresToPeriodAndQuota ¶
CoresToPeriodAndQuota converts a fraction of cores to the equivalent Completely Fair Scheduler (CFS) parameters period and quota.
Cores is a fraction of the CFS period that a container may use. Period and Quota are in microseconds.
func CreateIDFile ¶ added in v4.4.0
func DefaultContainerConfig ¶
func DeviceFromPath ¶ added in v4.2.0
func DeviceFromPath(path string) (*spec.LinuxDevice, error)
Copied from github.com/opencontainers/runc/libcontainer/devices Given the path to a device look up the information about a linux device
func ExecAddTERM ¶ added in v4.8.0
ExecAddTERM when container does not have a TERM environment variable and caller wants a tty, then leak the existing TERM environment into the container.
func ExitCode ¶
ExitCode reads the error message when failing to executing container process and then returns 0 if no error, 126 if command does not exist, or 127 for all other errors
func FiltersFromRequest ¶
filtersFromRequests extracts the "filters" parameter from the specified http.Request. The parameter can either be a `map[string][]string` as done in new versions of Docker and libpod, or a `map[string]map[string]bool` as done in older versions of Docker. We have to do a bit of Yoga to support both - just as Docker does as well.
Please refer to https://github.com/containers/podman/issues/6899 for some background.
func FindDeviceNodes ¶
FindDeviceNodes parses /dev/ into a set of major:minor -> path, where [major:minor] is the device's major and minor numbers formatted as, for example, 2:0 and path is the path to the device node. Symlinks to nodes are ignored.
func GetContainerPidInformationDescriptors ¶
GetContainerPidInformationDescriptors returns a string slice of all supported format descriptors of GetContainerPidInformation.
func GetIdentityPath ¶ added in v4.6.0
func GetKeepIDMapping ¶
func GetKeepIDMapping(opts *namespaces.KeepIDUserNsOptions) (*stypes.IDMappingOptions, int, int, error)
GetKeepIDMapping returns the mappings and the user to use when keep-id is used
func GetNoMapMapping ¶ added in v4.1.0
func GetNoMapMapping() (*stypes.IDMappingOptions, int, int, error)
GetNoMapMapping returns the mappings and the user to use when nomap is used
func GetRootlessConfigHomeDir ¶
GetRootlessConfigHomeDir returns the config home directory when running as non root
func GetRootlessPauseProcessPidPath ¶
GetRootlessPauseProcessPidPath returns the path to the file that holds the pid for the pause process.
func GetRuntimeDir ¶
GetRuntimeDir returns the runtime directory
func IDtoolsToRuntimeSpec ¶
IDtoolsToRuntimeSpec converts idtools ID mapping to the one of the runtime spec.
func IndexOfStringInSlice ¶ added in v4.7.0
IndexOfStringInSlice returns the index if a string is in a slice, otherwise it returns -1 if the string is not found
func OpenExclusiveFile ¶
OpenExclusiveFile opens a file for writing and ensure it doesn't already exist
func ParseDockerignore ¶ added in v4.5.0
Takes build context and validates `.containerignore` or `.dockerignore` if they are symlink outside of buildcontext. Returns list of files to be excluded and resolved path to the ignore files inside build context or error
func ParseIDMap ¶ added in v4.7.0
func ParseIDMap(mapSpec []string, mapSetting string, parentMapping []ruser.IDMap) (idmap []idtools.IDMap, err error)
Extension of idTools.ParseIDMap that parses idmap triples from string. This extension accepts additional flags that control how the mapping is done
func ParseIDMapping ¶
func ParseIDMapping(mode namespaces.UsernsMode, uidMapSlice, gidMapSlice []string, subUIDMap, subGIDMap string) (*stypes.IDMappingOptions, error)
ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping
func ParseInputTime ¶
ParseInputTime takes the users input and to determine if it is valid and returns a time format and error. The input is compared to known time formats or a duration which implies no-duration
func ParseRegistryCreds ¶
func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error)
ParseRegistryCreds takes a credentials string in the form USERNAME:PASSWORD and returns a DockerAuthConfig
func ParseRestartPolicy ¶ added in v4.6.0
ParseRestartPolicy parses the value given to the --restart flag and returns the policy and restart retries value
func ParseSignal ¶
ParseSignal parses and validates a signal name or number.
func PeriodAndQuotaToCores ¶
PeriodAndQuotaToCores takes the CFS parameters period and quota and returns a fraction that represents the limit to the number of cores that can be utilized over the scheduling period.
Cores is a fraction of the CFS period that a container may use. Period and Quota are in microseconds.
func PrepareFilters ¶
PrepareFilters prepares a *map[string][]string of filters to be later searched in lipod and compat API to get desired filters
func ProcessOptions ¶
ProcessOptions parses the options for a bind or tmpfs mount and ensures that they are sensible and follow convention. The isTmpfs variable controls whether extra, tmpfs-specific options will be allowed. The sourcePath variable, if not empty, contains a bind mount source.
func RuntimeSpecToIDtools ¶ added in v4.5.0
RuntimeSpecToIDtoolsTo converts runtime spec to the one of the idtools ID mapping
func SizeOfPath ¶ added in v4.0.3
SizeOfPath determines the file usage of a given path. it was called volumeSize in v1 and now is made to be generic and take a path instead of a libpod volume Deprecated: use github.com/containers/storage/pkg/directory.Size() instead.
func StringInSlice ¶
StringInSlice is deprecated, use containers/common/pkg/util/StringInSlice
func StringMatchRegexSlice ¶
StringMatchRegexSlice determines if a given string matches one of the given regexes, returns bool
func ValidateSysctls ¶
ValidateSysctls validates a list of sysctl and returns it.
func WriteStorageConfigFile ¶
func WriteStorageConfigFile(storageOpts *stypes.StoreOptions, storageConf string) error
WriteStorageConfigFile writes the configuration to a file
Types ¶
This section is empty.