shared

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 44 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKernelNamespaces = "cgroup,ipc,net,uts"

Functions

func CreateContainer added in v1.2.0

func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime) (*libpod.Container, *cc.CreateConfig, error)

func CreateContainerFromCreateConfig added in v1.2.0

func CreateContainerFromCreateConfig(r *libpod.Runtime, createConfig *cc.CreateConfig, ctx context.Context, pod *libpod.Pod) (*libpod.Container, error)

func CreatePodStatusResults added in v1.1.0

func CreatePodStatusResults(ctrStatuses map[string]define.ContainerStatus) (string, error)

func CreatePortBindings added in v1.0.0

func CreatePortBindings(ports []string) ([]ocicni.PortMapping, error)

CreatePortBindings iterates ports mappings and exposed ports into a format CNI understands

func DefaultPoolSize added in v1.3.0

func DefaultPoolSize(name string) int

DefaultPoolSize provides the maximum number of parallel workers (int) as calculated by a basic heuristic. This can be overridden by the --max-workers primary switch to podman.

func FilterAllPodsWithFilterFunc added in v1.8.2

func FilterAllPodsWithFilterFunc(r *libpod.Runtime, filters ...libpod.PodFilter) ([]*libpod.Pod, error)

FilterAllPodsWithFilterFunc retrieves all pods Filters can be provided which will determine which pods are included in the output. Multiple filters are handled by ANDing their output, so only pods matching all filters are returned

func GenerateCommand added in v0.10.1

func GenerateCommand(command, imageName, name, globalOpts string) ([]string, error)

GenerateCommand takes a label (string) and converts it to an executable command

func GenerateContainerFilterFuncs added in v1.7.0

func GenerateContainerFilterFuncs(filter, filterValue string, r *libpod.Runtime) (func(container *libpod.Container) bool, error)

GenerateContainerFilterFuncs return ContainerFilter functions based of filter.

func GenerateFilterFunction added in v1.8.2

func GenerateFilterFunction(r *libpod.Runtime, filters []string) ([]libpod.PodFilter, error)

GenerateFilterFunction basically gets the filters based on the input by the user and filter the pod list based on the criteria.

func GenerateKube added in v1.3.0

func GenerateKube(name string, service bool, r *libpod.Runtime) (*v1.Pod, *v1.Service, error)

GenerateKube generates kubernetes yaml based on a pod or container.

func GenerateRunEnvironment added in v0.10.1

func GenerateRunEnvironment(name, imageName string, opts map[string]string) []string

GenerateRunEnvironment merges the current environment variables with optional environment variables provided by the user

func GenerateRunlabelCommand added in v0.12.1

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 GetNamespaceInfo added in v1.8.1

func GetNamespaceInfo(path string) (string, error)

GetNamespaceInfo is an exported wrapper for getNamespaceInfo

func GetNamespaceOptions added in v0.8.4

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

func GetPodStatus(pod *libpod.Pod) (string, error)

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 GetPodsWithFilters added in v1.8.2

func GetPodsWithFilters(r *libpod.Runtime, filters string) ([]*libpod.Pod, error)

GetPodsWithFilters uses the cliconfig to categorize if the latest pod is required.

func GetRunlabel added in v0.12.1

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 construction of the runlabel output and environment variables.

func GetSystemContext added in v1.7.0

func GetSystemContext(authfile string) (*types.SystemContext, error)

func ParallelExecuteWorkerPool added in v0.11.1

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 added in v0.11.1

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 added in v0.11.1

func Parallelize(job string) int

Parallelize provides the maximum number of parallel workers (int) as calculated by a basic heuristic. This can be overridden by the --max-workers primary switch to podman.

func ParseCreateOpts added in v1.2.0

func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.Runtime, imageName string, rawImageName 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

func ParseVolumeOptions added in v1.6.3

func ParseVolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)

Handle volume options from CLI. Parse "o" option to find UID, GID.

func SharedRemoveVolumes added in v1.6.0

func SharedRemoveVolumes(ctx context.Context, runtime *libpod.Runtime, vols []string, all, force bool) ([]string, map[string]error, error)

Remove given set of volumes

Types

type BatchContainerStruct

type BatchContainerStruct struct {
	ConConfig   *libpod.ContainerConfig
	ConState    define.ContainerStatus
	ExitCode    int32
	Exited      bool
	Pid         int
	StartedTime time.Time
	ExitedTime  time.Time
	Size        *ContainerSize
}

BatchContainerStruct is the return object from BatchContainer and contains container related information.

func BatchContainerOp

func BatchContainerOp(ctr *libpod.Container, opts PsOptions) (BatchContainerStruct, error)

BatchContainerOp is used in ps to reduce performance hits by "batching" locks.

type CRBool added in v1.3.0

type CRBool struct {
	Val bool
	// contains filtered or unexported fields
}

CRBool describes a bool cli struct

func (CRBool) IsSet added in v1.3.0

func (c CRBool) IsSet() bool

IsSet ...

func (CRBool) Name added in v1.3.0

func (c CRBool) Name() string

Name ...

func (c CRBool) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRBool) Value added in v1.3.0

func (c CRBool) Value() interface{}

Value ...

type CRFloat64 added in v1.3.0

type CRFloat64 struct {
	Val float64
	// contains filtered or unexported fields
}

CRFloat64 describes a float64 cli struct

func (CRFloat64) IsSet added in v1.3.0

func (c CRFloat64) IsSet() bool

IsSet ...

func (CRFloat64) Name added in v1.3.0

func (c CRFloat64) Name() string

Name ...

func (c CRFloat64) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRFloat64) Value added in v1.3.0

func (c CRFloat64) Value() interface{}

Value ...

type CRInt added in v1.3.0

type CRInt struct {
	Val int
	// contains filtered or unexported fields
}

CRInt describes an int cli struct

func (CRInt) IsSet added in v1.3.0

func (c CRInt) IsSet() bool

IsSet ...

func (CRInt) Name added in v1.3.0

func (c CRInt) Name() string

Name ...

func (c CRInt) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRInt) Value added in v1.3.0

func (c CRInt) Value() interface{}

Value ...

type CRInt64 added in v1.3.0

type CRInt64 struct {
	Val int64
	// contains filtered or unexported fields
}

CRInt64 describes an int64 cli struct

func (CRInt64) IsSet added in v1.3.0

func (c CRInt64) IsSet() bool

IsSet ...

func (CRInt64) Name added in v1.3.0

func (c CRInt64) Name() string

Name ...

func (c CRInt64) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRInt64) Value added in v1.3.0

func (c CRInt64) Value() interface{}

Value ...

type CRString added in v1.3.0

type CRString struct {
	Val string
	// contains filtered or unexported fields
}

CRString describes a string cli struct

func (CRString) IsSet added in v1.3.0

func (c CRString) IsSet() bool

IsSet ...

func (CRString) Name added in v1.3.0

func (c CRString) Name() string

Name ...

func (c CRString) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRString) Value added in v1.3.0

func (c CRString) Value() interface{}

Value ...

type CRStringArray added in v1.3.0

type CRStringArray struct {
	Val []string
	// contains filtered or unexported fields
}

CRStringArray describes a stringarray cli struct

func (CRStringArray) IsSet added in v1.3.0

func (c CRStringArray) IsSet() bool

IsSet ...

func (CRStringArray) Name added in v1.3.0

func (c CRStringArray) Name() string

Name ...

func (c CRStringArray) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRStringArray) Value added in v1.3.0

func (c CRStringArray) Value() interface{}

Value ...

type CRStringSlice added in v1.3.0

type CRStringSlice struct {
	Val []string
	// contains filtered or unexported fields
}

CRStringSlice describes a string slice cli struct

func (CRStringSlice) IsSet added in v1.3.0

func (c CRStringSlice) IsSet() bool

IsSet ...

func (CRStringSlice) Name added in v1.3.0

func (c CRStringSlice) Name() string

Name ...

func (c CRStringSlice) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRStringSlice) Value added in v1.3.0

func (c CRStringSlice) Value() interface{}

Value ...

type CRUint added in v1.3.0

type CRUint struct {
	Val uint
	// contains filtered or unexported fields
}

CRUint describes a uint cli struct

func (CRUint) IsSet added in v1.3.0

func (c CRUint) IsSet() bool

IsSet ...

func (CRUint) Name added in v1.3.0

func (c CRUint) Name() string

Name ...

func (c CRUint) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRUint) Value added in v1.3.0

func (c CRUint) Value() interface{}

Value ...

type CRUint64 added in v1.3.0

type CRUint64 struct {
	Val uint64
	// contains filtered or unexported fields
}

CRUint64 describes a uint64 cli struct

func (CRUint64) IsSet added in v1.3.0

func (c CRUint64) IsSet() bool

IsSet ...

func (CRUint64) Name added in v1.3.0

func (c CRUint64) Name() string

Name ...

func (c CRUint64) ToVarlink() interface{}

ToString wrapper for build without varlink

func (CRUint64) Value added in v1.3.0

func (c CRUint64) Value() interface{}

Value ...

type ContainerSize

type ContainerSize struct {
	RootFsSize int64 `json:"rootFsSize"`
	RwSize     int64 `json:"rwSize"`
}

ContainerSize holds the size of the container's root filesystem and top read-write layer.

type GenericCLIResult added in v1.3.0

type GenericCLIResult interface {
	IsSet() bool
	Name() string
	Value() interface{}
}

GenericCLIResult describes the overall interface for dealing with the create command cli in both local and remote uses

type GenericCLIResults added in v1.3.0

type GenericCLIResults struct {
	InputArgs []string
	// contains filtered or unexported fields
}

GenericCLIResults in the intermediate object between the cobra cli and createconfig

func NewIntermediateLayer added in v1.3.0

func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIResults

NewIntermediateLayer creates a GenericCLIResults from a create or run cli-command

func (GenericCLIResults) Bool added in v1.3.0

func (f GenericCLIResults) Bool(flag string) bool

Bool is a wrapper to get a bool value from GenericCLIResults

func (GenericCLIResults) Changed added in v1.3.0

func (f GenericCLIResults) Changed(flag string) bool

Float64 is a wrapper to get an float64 value from GenericCLIResults

func (GenericCLIResults) Float64 added in v1.3.0

func (f GenericCLIResults) Float64(flag string) float64

Float64 is a wrapper to get an float64 value from GenericCLIResults

func (GenericCLIResults) Int added in v1.3.0

func (f GenericCLIResults) Int(flag string) int

Int is a wrapper to get an int value from GenericCLIResults

func (GenericCLIResults) Int64 added in v1.3.0

func (f GenericCLIResults) Int64(flag string) int64

Int64 is a wrapper to get an int64 value from GenericCLIResults

func (GenericCLIResults) IsSet added in v1.3.0

func (f GenericCLIResults) IsSet(flag string) bool

IsSet returns a bool if the flag was changed

func (GenericCLIResults) String added in v1.3.0

func (f GenericCLIResults) String(flag string) string

String is a wrapper to get a string value from GenericCLIResults

func (GenericCLIResults) StringArray added in v1.3.0

func (f GenericCLIResults) StringArray(flag string) []string

StringArray is a wrapper to get a stringslice value from GenericCLIResults

func (GenericCLIResults) StringSlice added in v1.3.0

func (f GenericCLIResults) StringSlice(flag string) []string

StringSlice is a wrapper to get a stringslice value from GenericCLIResults

func (GenericCLIResults) Uint added in v1.3.0

func (f GenericCLIResults) Uint(flag string) uint

Uint is a wrapper to get an uint value from GenericCLIResults

func (GenericCLIResults) Uint64 added in v1.3.0

func (f GenericCLIResults) Uint64(flag string) uint64

Uint64 is a wrapper to get an uint64 value from GenericCLIResults

func (GenericCLIResults) Value added in v1.3.0

func (f GenericCLIResults) Value(flag string) interface{}

Value returns the value of the cli flag

type Job added in v1.3.0

type Job struct {
	ID string
	Fn JobFunc
}

Job defines the function to run

type JobFunc added in v1.3.0

type JobFunc func() error

JobFunc provides the function signature for the pool'ed functions

type JobResult added in v1.3.0

type JobResult struct {
	Job Job
	Err error
}

JobResult defines the results from the function ran

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

func GetNamespaces(pid int) *Namespace

GetNamespaces returns a populated namespace struct.

type ParallelWorkerInput added in v0.11.1

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 added in v1.3.0

type Pool struct {
	// contains filtered or unexported fields
}

Pool defines the worker pool and queues

func NewPool added in v1.3.0

func NewPool(id string, size int, capacity int) *Pool

NewPool creates and initializes a new Pool

func (*Pool) Add added in v1.3.0

func (p *Pool) Add(job Job)

Add Job to pool for parallel processing

func (*Pool) Run added in v1.3.0

func (p *Pool) Run() ([]string, map[string]error, error)

Run the Job's in the pool, gather and return results

type PsContainerOutput added in v0.11.1

type PsContainerOutput struct {
	ID        string
	Image     string
	ImageID   string
	Command   string
	Created   string
	Ports     string
	Names     string
	IsInfra   bool
	Status    string
	State     define.ContainerStatus
	Pid       int
	Size      *ContainerSize
	Pod       string
	PodName   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 added in v1.3.0

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 added in v0.11.1

func NewBatchContainer(r *libpod.Runtime, 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.

func PBatch added in v0.11.1

func PBatch(r *libpod.Runtime, containers []*libpod.Container, workers int, opts PsOptions) []PsContainerOutput

PBatch performs batch operations on a container in parallel. It spawns the number of workers relative to the number of parallel operations desired.

type PsOptions

type PsOptions struct {
	All       bool
	Format    string
	Last      int
	Latest    bool
	NoTrunc   bool
	Pod       bool
	Quiet     bool
	Size      bool
	Sort      string
	Namespace bool
	Sync      bool
}

PsOptions describes the struct being formed for ps.

Directories

Path Synopsis
nolint most of these validate and parse functions have been taken from projectatomic/docker and modified for cri-o
nolint most of these validate and parse functions have been taken from projectatomic/docker and modified for cri-o

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL