Documentation
¶
Index ¶
- Constants
- Variables
- func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime) (*libpod.Container, *cc.CreateConfig, error)
- func CreateContainerFromCreateConfig(r *libpod.Runtime, createConfig *cc.CreateConfig, ctx context.Context, ...) (*libpod.Container, error)
- func CreatePodStatusResults(ctrStatuses map[string]libpod.ContainerStatus) (string, error)
- func CreatePortBindings(ports []string) ([]ocicni.PortMapping, error)
- func DefaultPoolSize(name string) int
- func EnvVariablesFromData(data *inspect.ImageData) map[string]string
- func GenerateCommand(command, imageName, name, globalOpts string) ([]string, error)
- func GenerateKube(name string, service bool, r *libpod.Runtime) (*v1.Pod, *v1.Service, error)
- func GenerateRunEnvironment(name, imageName string, opts map[string]string) []string
- func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]string, extraArgs []string, ...) ([]string, []string, error)
- func GetAllLabels(labelFile, inputLabels []string) (map[string]string, error)
- func GetNamespaceOptions(ns []string) ([]libpod.PodCreateOption, error)
- func GetPodStatus(pod *libpod.Pod) (string, error)
- func GetRunlabel(label string, runlabelImage string, ctx context.Context, ...) (string, string, error)
- func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (map[string]error, int)
- func ParallelWorker(wg *sync.WaitGroup, jobs <-chan ParallelWorkerInput, ...)
- func Parallelize(job string) int
- func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime, ...) (*cc.CreateConfig, error)
- type BatchContainerStruct
- type CRBool
- type CRFloat64
- type CRInt
- type CRInt64
- type CRString
- type CRStringArray
- type CRStringSlice
- type CRUint
- type CRUint64
- type ContainerSize
- type GenericCLIResult
- type GenericCLIResults
- func (f GenericCLIResults) Bool(flag string) bool
- func (f GenericCLIResults) Changed(flag string) bool
- func (f GenericCLIResults) Float64(flag string) float64
- func (f GenericCLIResults) Int(flag string) int
- func (f GenericCLIResults) Int64(flag string) int64
- func (f GenericCLIResults) IsSet(flag string) bool
- func (f GenericCLIResults) String(flag string) string
- func (f GenericCLIResults) StringArray(flag string) []string
- func (f GenericCLIResults) StringSlice(flag string) []string
- func (f GenericCLIResults) Uint(flag string) uint
- func (f GenericCLIResults) Uint64(flag string) uint64
- func (f GenericCLIResults) Value(flag string) interface{}
- type InspectContainer
- type InspectContainerConfig
- type InspectContainerHostConfig
- type InspectLogConfig
- type Job
- type JobFunc
- type JobResult
- type Namespace
- type ParallelWorkerInput
- type Pool
- type PsContainerOutput
- func GetPsContainerOutput(r *libpod.Runtime, opts PsOptions, filters []string, maxWorkers int) ([]PsContainerOutput, error)
- func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput, error)
- func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsContainerOutput
- type PsOptions
Constants ¶
const ( PodStateStopped = "Stopped" PodStateRunning = "Running" PodStatePaused = "Paused" PodStateExited = "Exited" PodStateErrored = "Error" PodStateCreated = "Created" )
Variables ¶
var DefaultKernelNamespaces = "cgroup,ipc,net,uts"
Functions ¶
func CreateContainer ¶
func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime) (*libpod.Container, *cc.CreateConfig, error)
func CreatePodStatusResults ¶
func CreatePodStatusResults(ctrStatuses map[string]libpod.ContainerStatus) (string, error)
func CreatePortBindings ¶
func CreatePortBindings(ports []string) ([]ocicni.PortMapping, error)
CreatePortBindings iterates ports mappings and exposed ports into a format CNI understands
func DefaultPoolSize ¶
DefaultPoolSize provides the maximum number of parallel workers (int) as calculated by a basic heuristic. This can be overriden by the --max-workers primary switch to podman.
func EnvVariablesFromData ¶
EnvVariablesFromData gets sets the default environment variables for containers, and reads the variables from the image data, if present.
func GenerateCommand ¶
GenerateCommand takes a label (string) and converts it to an executable command
func GenerateKube ¶
GenerateKube generates kubernetes yaml based on a pod or container
func GenerateRunEnvironment ¶
GenerateRunEnvironment merges the current environment variables with optional environment variables provided by the user
func GenerateRunlabelCommand ¶
func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]string, extraArgs []string, globalOpts string) ([]string, []string, error)
GenerateRunlabelCommand generates the command that will eventually be execucted by podman
func GetAllLabels ¶
GetAllLabels ...
func GetNamespaceOptions ¶
func GetNamespaceOptions(ns []string) ([]libpod.PodCreateOption, error)
GetNamespaceOptions transforms a slice of kernel namespaces into a slice of pod create options. Currently, not all kernel namespaces are supported, and they will be returned in an error
func GetPodStatus ¶
GetPodStatus determines the status of the pod based on the statuses of the containers in the pod. Returns a string representation of the pod status
func GetRunlabel ¶
func GetRunlabel(label string, runlabelImage string, ctx context.Context, runtime *libpod.Runtime, pull bool, inputCreds string, dockerRegistryOptions image.DockerRegistryOptions, authfile string, signaturePolicyPath string, output io.Writer) (string, string, error)
GetRunlabel is a helper function for runlabel; it gets the image if needed and begins the contruction of the runlabel output and environment variables
func ParallelExecuteWorkerPool ¶
func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (map[string]error, int)
ParallelExecuteWorkerPool takes container jobs and performs them in parallel. The worker int determines how many workers/threads should be premade.
func ParallelWorker ¶
func ParallelWorker(wg *sync.WaitGroup, jobs <-chan ParallelWorkerInput, results chan<- containerError)
ParallelWorker is a "threaded" worker that takes jobs from the channel "queue"
func Parallelize ¶
Parallelize provides the maximum number of parallel workers (int) as calculated by a basic heuristic. This can be overriden by the --max-workers primary switch to podman.
func ParseCreateOpts ¶
func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime, imageName string, data *inspect.ImageData) (*cc.CreateConfig, error)
Parses CLI options related to container creation into a config which can be parsed into an OCI runtime spec
Types ¶
type BatchContainerStruct ¶
type BatchContainerStruct struct { ConConfig *libpod.ContainerConfig ConState libpod.ContainerStatus ExitCode int32 Exited bool Pid int StartedTime time.Time ExitedTime time.Time Size *ContainerSize }
BatchContainerStruct is the return obkect from BatchContainer and contains container related information
func BatchContainerOp ¶
func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error)
BatchContainer is used in ps to reduce performance hits by "batching" locks.
type CRBool ¶
type CRBool struct { Val bool // contains filtered or unexported fields }
CRBool describes a bool cli struct
type CRFloat64 ¶
type CRFloat64 struct { Val float64 // contains filtered or unexported fields }
CRFloat64 describes a float64 cli struct
type CRInt ¶
type CRInt struct { Val int // contains filtered or unexported fields }
CRInt describes an int cli struct
type CRInt64 ¶
type CRInt64 struct { Val int64 // contains filtered or unexported fields }
CRInt64 describes an int64 cli struct
type CRString ¶
type CRString struct { Val string // contains filtered or unexported fields }
CRString describes a string cli struct
type CRStringArray ¶
type CRStringArray struct { Val []string // contains filtered or unexported fields }
CRStringArray describes a stringarray cli struct
func (CRStringArray) ToVarlink ¶
func (c CRStringArray) ToVarlink() interface{}
ToString wrapper for build without varlink
type CRStringSlice ¶
type CRStringSlice struct { Val []string // contains filtered or unexported fields }
CRStringSlice describes a string slice cli struct
func (CRStringSlice) ToVarlink ¶
func (c CRStringSlice) ToVarlink() interface{}
ToString wrapper for build without varlink
type CRUint ¶
type CRUint struct { Val uint // contains filtered or unexported fields }
CRUint describes a uint cli struct
type CRUint64 ¶
type CRUint64 struct { Val uint64 // contains filtered or unexported fields }
CRUint64 describes a uint64 cli struct
type ContainerSize ¶
ContainerSize holds the size of the container's root filesystem and top read-write layer
type GenericCLIResult ¶
GenericCLIResult describes the overall interface for dealing with the create command cli in both local and remote uses
type GenericCLIResults ¶
type GenericCLIResults struct { InputArgs []string // contains filtered or unexported fields }
GenericCLIResults in the intermediate object between the cobra cli and createconfig
func NewIntermediateLayer ¶
func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIResults
NewIntermediateLayer creates a GenericCLIResults from a create or run cli-command
func (GenericCLIResults) Bool ¶
func (f GenericCLIResults) Bool(flag string) bool
Bool is a wrapper to get a bool value from GenericCLIResults
func (GenericCLIResults) Changed ¶
func (f GenericCLIResults) Changed(flag string) bool
Float64 is a wrapper to get an float64 value from GenericCLIResults
func (GenericCLIResults) Float64 ¶
func (f GenericCLIResults) Float64(flag string) float64
Float64 is a wrapper to get an float64 value from GenericCLIResults
func (GenericCLIResults) Int ¶
func (f GenericCLIResults) Int(flag string) int
Int is a wrapper to get an int value from GenericCLIResults
func (GenericCLIResults) Int64 ¶
func (f GenericCLIResults) Int64(flag string) int64
Int64 is a wrapper to get an int64 value from GenericCLIResults
func (GenericCLIResults) IsSet ¶
func (f GenericCLIResults) IsSet(flag string) bool
IsSet returns a bool if the flag was changed
func (GenericCLIResults) String ¶
func (f GenericCLIResults) String(flag string) string
String is a wrapper to get a string value from GenericCLIResults
func (GenericCLIResults) StringArray ¶
func (f GenericCLIResults) StringArray(flag string) []string
StringArray is a wrapper to get a stringslice value from GenericCLIResults
func (GenericCLIResults) StringSlice ¶
func (f GenericCLIResults) StringSlice(flag string) []string
StringSlice is a wrapper to get a stringslice value from GenericCLIResults
func (GenericCLIResults) Uint ¶
func (f GenericCLIResults) Uint(flag string) uint
Uint is a wrapper to get an uint value from GenericCLIResults
func (GenericCLIResults) Uint64 ¶
func (f GenericCLIResults) Uint64(flag string) uint64
Uint64 is a wrapper to get an uint64 value from GenericCLIResults
func (GenericCLIResults) Value ¶
func (f GenericCLIResults) Value(flag string) interface{}
Value returns the value of the cli flag
type InspectContainer ¶
type InspectContainer struct { *libpod.InspectContainerData HostConfig *InspectContainerHostConfig `json:"HostConfig"` Config *InspectContainerConfig `json:"Config"` }
InspectContainer holds all inspect data for a container. The format of individual components is fixed so the overall structure, when JSON encoded, matches the output of `docker inspect`. It combines Libpod-source inspect data with Podman-specific inspect data.
func GetCtrInspectInfo ¶
func GetCtrInspectInfo(config *libpod.ContainerConfig, ctrInspectData *libpod.InspectContainerData, createArtifact *cc.CreateConfig) (*InspectContainer, error)
GetCtrInspectInfo inspects a container, combining Libpod inspect information with other information not stored in Libpod and returning a struct that, when formatted for JSON output, is compatible with `docker inspect`.
type InspectContainerConfig ¶
type InspectContainerConfig struct { Hostname string `json:"Hostname"` DomainName string `json:"Domainname"` //TODO User specs.User `json:"User"` AttachStdin bool `json:"AttachStdin"` //TODO AttachStdout bool `json:"AttachStdout"` //TODO AttachStderr bool `json:"AttachStderr"` //TODO Tty bool `json:"Tty"` OpenStdin bool `json:"OpenStdin"` StdinOnce bool `json:"StdinOnce"` //TODO Env []string `json:"Env"` Cmd []string `json:"Cmd"` Image string `json:"Image"` Volumes map[string]struct{} `json:"Volumes"` WorkingDir string `json:"WorkingDir"` Entrypoint string `json:"Entrypoint"` Labels map[string]string `json:"Labels"` Annotations map[string]string `json:"Annotations"` StopSignal uint `json:"StopSignal"` Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` }
InspectContainerConfig holds further data about a container, again mostly not directly stored in Libpod. This struct is matched to the output of `docker inspect`.
type InspectContainerHostConfig ¶
type InspectContainerHostConfig struct { ContainerIDFile string `json:"ContainerIDFile"` LogConfig *InspectLogConfig `json:"LogConfig"` //TODO NetworkMode string `json:"NetworkMode"` PortBindings nat.PortMap `json:"PortBindings"` //TODO AutoRemove bool `json:"AutoRemove"` CapAdd []string `json:"CapAdd"` CapDrop []string `json:"CapDrop"` DNS []string `json:"DNS"` DNSOptions []string `json:"DNSOptions"` DNSSearch []string `json:"DNSSearch"` ExtraHosts []string `json:"ExtraHosts"` GroupAdd []uint32 `json:"GroupAdd"` IpcMode string `json:"IpcMode"` Cgroup string `json:"Cgroup"` OomScoreAdj *int `json:"OomScoreAdj"` PidMode string `json:"PidMode"` Privileged bool `json:"Privileged"` PublishAllPorts bool `json:"PublishAllPorts"` //TODO ReadOnlyRootfs bool `json:"ReadonlyRootfs"` ReadOnlyTmpfs bool `json:"ReadonlyTmpfs"` SecurityOpt []string `json:"SecurityOpt"` UTSMode string `json:"UTSMode"` UsernsMode string `json:"UsernsMode"` ShmSize int64 `json:"ShmSize"` Runtime string `json:"Runtime"` ConsoleSize *specs.Box `json:"ConsoleSize"` Memory int64 `json:"Memory"` NanoCPUs int `json:"NanoCpus"` CgroupParent string `json:"CgroupParent"` BlkioWeight *uint16 `json:"BlkioWeight"` BlkioWeightDevice []specs.LinuxWeightDevice `json:"BlkioWeightDevice"` BlkioDeviceReadBps []specs.LinuxThrottleDevice `json:"BlkioDeviceReadBps"` BlkioDeviceWriteBps []specs.LinuxThrottleDevice `json:"BlkioDeviceWriteBps"` BlkioDeviceReadIOps []specs.LinuxThrottleDevice `json:"BlkioDeviceReadIOps"` BlkioDeviceWriteIOps []specs.LinuxThrottleDevice `json:"BlkioDeviceWriteIOps"` CPUPeriod *uint64 `json:"CpuPeriod"` CPUQuota *int64 `json:"CpuQuota"` CPURealtimePeriod *uint64 `json:"CpuRealtimePeriod"` CPURealtimeRuntime *int64 `json:"CpuRealtimeRuntime"` CPUSetCPUs string `json:"CpuSetCpus"` CPUSetMems string `json:"CpuSetMems"` Devices []specs.LinuxDevice `json:"Devices"` DiskQuota int `json:"DiskQuota"` //check type, TODO KernelMemory *int64 `json:"KernelMemory"` MemoryReservation *int64 `json:"MemoryReservation"` MemorySwap *int64 `json:"MemorySwap"` MemorySwappiness *uint64 `json:"MemorySwappiness"` OomKillDisable *bool `json:"OomKillDisable"` PidsLimit *int64 `json:"PidsLimit"` Ulimits []string `json:"Ulimits"` CPUCount int `json:"CpuCount"` CPUPercent int `json:"CpuPercent"` IOMaximumIOps int `json:"IOMaximumIOps"` //check type, TODO IOMaximumBandwidth int `json:"IOMaximumBandwidth"` //check type, TODO Tmpfs []string `json:"Tmpfs"` }
InspectContainerHostConfig holds Container configuration that is not specific to Libpod. This information is (mostly) stored by Podman as an artifact. This struct is matched to the output of `docker inspect`.
type InspectLogConfig ¶
type InspectLogConfig struct { Type string `json:"Type"` Config map[string]string `json:"Config"` //idk type, TODO }
InspectLogConfig holds information about a container's configured log driver and is presently unused. It is retained for Docker compatability.
type JobFunc ¶
type JobFunc func() error
JobFunc provides the function signature for the pool'ed functions
type Namespace ¶
type Namespace struct { PID string `json:"pid,omitempty"` Cgroup string `json:"cgroup,omitempty"` IPC string `json:"ipc,omitempty"` MNT string `json:"mnt,omitempty"` NET string `json:"net,omitempty"` PIDNS string `json:"pidns,omitempty"` User string `json:"user,omitempty"` UTS string `json:"uts,omitempty"` }
Namespace describes output for ps namespace
func GetNamespaces ¶
GetNamespaces returns a populated namespace struct
type ParallelWorkerInput ¶
type ParallelWorkerInput struct { ContainerID string ParallelFunc pFunc }
ParallelWorkerInput is a struct used to pass in a slice of parallel funcs to be performed on a container ID
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool defines the worker pool and queues
type PsContainerOutput ¶
type PsContainerOutput struct { ID string Image string Command string Created string Ports string Names string IsInfra bool Status string State libpod.ContainerStatus Pid int Size *ContainerSize Pod string CreatedAt time.Time ExitedAt time.Time StartedAt time.Time Labels map[string]string PID string Cgroup string IPC string MNT string NET string PIDNS string User string UTS string Mounts string }
PsContainerOutput is the struct being returned from a parallel Batch operation
func GetPsContainerOutput ¶
func GetPsContainerOutput(r *libpod.Runtime, opts PsOptions, filters []string, maxWorkers int) ([]PsContainerOutput, error)
GetPsContainerOutput returns a slice of containers specifically for ps output
func NewBatchContainer ¶
func NewBatchContainer(ctr *libpod.Container, opts PsOptions) (PsContainerOutput, error)
NewBatchContainer runs a batch process under one lock to get container information and only be called in PBatch