summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-08-17 10:36:51 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-23 18:16:28 +0000
commit2a7449362f2884d9ae6a783c0ce38979d882e2cf (patch)
tree6e7b8ab33505d210201e62faba6a50f98c0a4ea7
parent697b46430a8a7c2c7231078911dcec51f0c6fab5 (diff)
downloadpodman-2a7449362f2884d9ae6a783c0ce38979d882e2cf.tar.gz
podman-2a7449362f2884d9ae6a783c0ce38979d882e2cf.tar.bz2
podman-2a7449362f2884d9ae6a783c0ce38979d882e2cf.zip
Change pause container to infra container
Signed-off-by: haircommander <pehunt@redhat.com> Closes: #1187 Approved by: mheon
-rw-r--r--cmd/podman/libpodruntime/runtime.go8
-rw-r--r--cmd/podman/pod_create.go32
-rw-r--r--cmd/podman/pod_ps.go16
-rw-r--r--cmd/podman/ps.go18
-rw-r--r--cmd/podman/varlink/io.podman.varlink4
-rw-r--r--completions/bash/podman6
-rw-r--r--docs/podman-pod-create.1.md32
-rw-r--r--libpod/container.go10
-rw-r--r--libpod/container_ffjson.go28
-rw-r--r--libpod/container_inspect.go2
-rw-r--r--libpod/container_internal_linux.go2
-rw-r--r--libpod/options.go28
-rw-r--r--libpod/pod.go32
-rw-r--r--libpod/pod_api.go4
-rw-r--r--libpod/pod_ffjson.go151
-rw-r--r--libpod/pod_internal.go2
-rw-r--r--libpod/runtime.go20
-rw-r--r--libpod/runtime_ctr.go6
-rw-r--r--libpod/runtime_pod_infra_linux.go (renamed from libpod/runtime_pod_pause_linux.go)20
-rw-r--r--libpod/runtime_pod_linux.go14
-rw-r--r--pkg/inspect/inspect.go2
-rw-r--r--pkg/varlinkapi/pods.go12
-rw-r--r--test/e2e/libpod_suite_test.go8
-rw-r--r--test/e2e/pod_infra_container_test.go (renamed from test/e2e/pod_pause_container_test.go)24
-rw-r--r--test/e2e/pod_stats_test.go32
25 files changed, 251 insertions, 262 deletions
diff --git a/cmd/podman/libpodruntime/runtime.go b/cmd/podman/libpodruntime/runtime.go
index af6be0602..ec105719f 100644
--- a/cmd/podman/libpodruntime/runtime.go
+++ b/cmd/podman/libpodruntime/runtime.go
@@ -125,12 +125,12 @@ func GetRuntimeWithStorageOpts(c *cli.Context, storageOpts *storage.StoreOptions
// TODO flag to set CNI plugins dir?
// Pod create options
- if c.IsSet("pause-image") {
- options = append(options, libpod.WithDefaultPauseImage(c.String("pause-image")))
+ if c.IsSet("infra-image") {
+ options = append(options, libpod.WithDefaultInfraImage(c.String("infra-image")))
}
- if c.IsSet("pause-command") {
- options = append(options, libpod.WithDefaultPauseCommand(c.String("pause-command")))
+ if c.IsSet("infra-command") {
+ options = append(options, libpod.WithDefaultInfraCommand(c.String("infra-command")))
}
return libpod.NewRuntime(options...)
diff --git a/cmd/podman/pod_create.go b/cmd/podman/pod_create.go
index f5bb29c35..eb07e7d50 100644
--- a/cmd/podman/pod_create.go
+++ b/cmd/podman/pod_create.go
@@ -28,6 +28,18 @@ var podCreateFlags = []cli.Flag{
Name: "cgroup-parent",
Usage: "Set parent cgroup for the pod",
},
+ cli.BoolTFlag{
+ Name: "infra",
+ Usage: "Create an infra container associated with the pod to share namespaces with",
+ },
+ cli.StringFlag{
+ Name: "infra-image",
+ Usage: "The image of the infra container to associate with the pod",
+ },
+ cli.StringFlag{
+ Name: "infra-command",
+ Usage: "The command to run on the infra container when the pod is started",
+ },
cli.StringSliceFlag{
Name: "label-file",
Usage: "Read in a line delimited file of labels (default [])",
@@ -40,18 +52,6 @@ var podCreateFlags = []cli.Flag{
Name: "name, n",
Usage: "Assign a name to the pod",
},
- cli.BoolTFlag{
- Name: "pause",
- Usage: "Create a pause container associated with the pod to share namespaces with",
- },
- cli.StringFlag{
- Name: "pause-image",
- Usage: "The image of the pause container to associate with the pod",
- },
- cli.StringFlag{
- Name: "pause-command",
- Usage: "The command to run on the pause container when the pod is started",
- },
cli.StringFlag{
Name: "pod-id-file",
Usage: "Write the pod ID to the file",
@@ -95,8 +95,8 @@ func podCreateCmd(c *cli.Context) error {
return errors.Wrapf(err, "unable to write pod id file %s", c.String("pod-id-file"))
}
}
- if !c.BoolT("pause") && c.IsSet("share") && c.String("share") != "none" && c.String("share") != "" {
- return errors.Errorf("You cannot share kernel namespaces on the pod level without a pause container")
+ if !c.BoolT("infra") && c.IsSet("share") && c.String("share") != "none" && c.String("share") != "" {
+ return errors.Errorf("You cannot share kernel namespaces on the pod level without an infra container")
}
if c.IsSet("cgroup-parent") {
@@ -115,8 +115,8 @@ func podCreateCmd(c *cli.Context) error {
options = append(options, libpod.WithPodName(c.String("name")))
}
- if c.BoolT("pause") {
- options = append(options, libpod.WithPauseContainer())
+ if c.BoolT("infra") {
+ options = append(options, libpod.WithInfraContainer())
nsOptions, err := shared.GetNamespaceOptions(strings.Split(c.String("share"), ","))
if err != nil {
return err
diff --git a/cmd/podman/pod_ps.go b/cmd/podman/pod_ps.go
index 20cda1276..58f404e7a 100644
--- a/cmd/podman/pod_ps.go
+++ b/cmd/podman/pod_ps.go
@@ -57,7 +57,7 @@ type podPsTemplateParams struct {
Status string
Cgroup string
ContainerInfo string
- PauseContainerID string
+ InfraContainerID string
SharedNamespaces string
}
@@ -74,7 +74,7 @@ type podPsJSONParams struct {
Status string `json:"status"`
CtrsInfo []podPsCtrInfo `json:"containerinfo,omitempty"`
Cgroup string `json:"cgroup,omitempty"`
- PauseContainerID string `json:"pausecontainerid,omitempty"`
+ InfraContainerID string `json:"infracontainerid,omitempty"`
SharedNamespaces []string `json:"sharednamespaces,omitempty"`
}
@@ -358,7 +358,7 @@ func genPodPsFormat(c *cli.Context) string {
} else {
format += "\t{{.NumberOfContainers}}"
}
- format += "\t{{.PauseContainerID}}"
+ format += "\t{{.InfraContainerID}}"
}
return format
}
@@ -418,7 +418,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
for _, psParam := range psParams {
podID := psParam.ID
- pauseID := psParam.PauseContainerID
+ infraID := psParam.InfraContainerID
var ctrStr string
truncated := ""
@@ -428,7 +428,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
psParam.CtrsInfo = psParam.CtrsInfo[:NUM_CTR_INFO]
truncated = "..."
}
- pauseID = shortID(pauseID)
+ infraID = shortID(infraID)
}
for _, ctrInfo := range psParam.CtrsInfo {
ctrStr += "[ "
@@ -456,7 +456,7 @@ func getPodTemplateOutput(psParams []podPsJSONParams, opts podPsOptions) ([]podP
NumberOfContainers: psParam.NumberOfContainers,
Cgroup: psParam.Cgroup,
ContainerInfo: ctrStr,
- PauseContainerID: pauseID,
+ InfraContainerID: infraID,
SharedNamespaces: strings.Join(psParam.SharedNamespaces, ","),
}
@@ -510,7 +510,7 @@ func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *lib
return nil, err
}
- pauseContainerID, err := pod.PauseContainerID()
+ infraContainerID, err := pod.InfraContainerID()
if err != nil {
return nil, err
}
@@ -547,7 +547,7 @@ func getAndSortPodJSONParams(pods []*libpod.Pod, opts podPsOptions, runtime *lib
NumberOfContainers: ctrNum,
CtrsInfo: ctrsInfo,
SharedNamespaces: getSharedNamespaces(pod),
- PauseContainerID: pauseContainerID,
+ InfraContainerID: infraContainerID,
}
psOutput = append(psOutput, params)
diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go
index 332416d14..82309c2ef 100644
--- a/cmd/podman/ps.go
+++ b/cmd/podman/ps.go
@@ -44,7 +44,7 @@ type psTemplateParams struct {
User string
UTS string
Pod string
- IsPause bool
+ IsInfra bool
}
// psJSONParams is used as a base structure for the psParams
@@ -72,7 +72,7 @@ type psJSONParams struct {
ContainerRunning bool `json:"ctrRunning"`
Namespaces *shared.Namespace `json:"namespace,omitempty"`
Pod string `json:"pod,omitempty"`
- IsPause bool `json:"pause"`
+ IsInfra bool `json:"infra"`
}
// Type declaration and functions for sorting the PS output
@@ -241,8 +241,8 @@ func psCmd(c *cli.Context) error {
// only get running containers
filterFuncs = append(filterFuncs, func(c *libpod.Container) bool {
state, _ := c.State()
- // Don't return pause containers
- return state == libpod.ContainerStateRunning && !c.IsPause()
+ // Don't return infra containers
+ return state == libpod.ContainerStateRunning && !c.IsInfra()
})
}
@@ -420,7 +420,7 @@ func generateContainerFilterFuncs(filter, filterValue string, runtime *libpod.Ru
}
// generate the template based on conditions given
-func genPsFormat(format string, quiet, size, namespace, pod, pause bool) string {
+func genPsFormat(format string, quiet, size, namespace, pod, infra bool) string {
if format != "" {
// "\t" from the command line is not being recognized as a tab
// replacing the string "\t" to a tab character if the user passes in "\t"
@@ -441,8 +441,8 @@ func genPsFormat(format string, quiet, size, namespace, pod, pause bool) string
if size {
format += "{{.Size}}\t"
}
- if pause {
- format += "{{.IsPause}}\t"
+ if infra {
+ format += "{{.IsInfra}}\t"
}
return format
}
@@ -578,7 +578,7 @@ func getTemplateOutput(psParams []psJSONParams, opts shared.PsOptions) ([]psTemp
Mounts: getMounts(psParam.Mounts, opts.NoTrunc),
PID: psParam.PID,
Pod: pod,
- IsPause: psParam.IsPause,
+ IsInfra: psParam.IsInfra,
}
if opts.Namespace {
@@ -635,7 +635,7 @@ func getAndSortJSONParams(containers []*libpod.Container, opts shared.PsOptions)
ContainerRunning: batchInfo.ConState == libpod.ContainerStateRunning,
Namespaces: ns,
Pod: ctr.PodID(),
- IsPause: ctr.IsPause(),
+ IsInfra: ctr.IsInfra(),
}
psOutput = append(psOutput, params)
diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink
index 5c122d86f..18b705bb8 100644
--- a/cmd/podman/varlink/io.podman.varlink
+++ b/cmd/podman/varlink/io.podman.varlink
@@ -343,7 +343,7 @@ type PodCreate (
cgroupParent: string,
labels: [string]string,
share: []string,
- pause: bool
+ infra: bool
)
# ListPodData is the returned struct for an individual pod
@@ -656,7 +656,7 @@ method PullImage(name: string) -> (id: string)
# "pod": "b05dee7bd4ccfee688099fe1588a7a898d6ddd6897de9251d4671c9b0feacb2a"
# }
#
-# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"pause": true, "share": ["ipc", "net", "uts"]}}'
+# $ varlink call unix:/run/podman/io.podman/io.podman.CreatePod '{"create": {"infra": true, "share": ["ipc", "net", "uts"]}}'
# {
# "pod": "d7697449a8035f613c1a8891286502aca68fff7d5d49a85279b3bda229af3b28"
# }
diff --git a/completions/bash/podman b/completions/bash/podman
index 7aa85053c..2aa46f5fa 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -2077,9 +2077,9 @@ _podman_logout() {
_podman_pod_create() {
local options_with_args="
--cgroup-parent
+ --infra-command
+ --infra-image
--share
- --pause-command
- --pause-image
--podidfile
--label-file
--label
@@ -2088,7 +2088,7 @@ _podman_pod_create() {
"
local boolean_options="
- --pause
+ --infra
"
_complete_ "$options_with_args" "$boolean_options"
}
diff --git a/docs/podman-pod-create.1.md b/docs/podman-pod-create.1.md
index 063dbc918..1d8ce9175 100644
--- a/docs/podman-pod-create.1.md
+++ b/docs/podman-pod-create.1.md
@@ -19,14 +19,22 @@ containers added to it. The pod id is printed to STDOUT. You can then use
Path to cgroups under which the cgroup for the pod will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.
-**--podidfile**=""
-
-Write the pod ID to the file
-
**--help**
Print usage statement
+**--infra**
+
+Create an infra container and associate it with the pod. An infra container is a lightweight container used to coordinate the shared kernel namespace of a pod. Default: true
+
+**--infra-command**=""
+
+The command that will be run to start the infra container. Default: "/pause"
+
+**--infra-image**=""
+
+The image that will be created for the infra container. Default: "k8s.gcr.io/pause:3.1"
+
**-l**, **--label**=[]
Add metadata to a pod (e.g., --label com.example.key=value)
@@ -39,17 +47,9 @@ Read in a line delimited file of labels
Assign a name to the pod
-**--pause**
-
-Create a pause container and associate it with the pod. A pause container is a lightweight container used to coordinate the shared kernel namespace of a pod. Default: true
-
-**--pause-command**=""
-
-The command that will be run to start the pause container. Default: "/pause"
-
-**--pause-image**=""
+**--podidfile**=""
-The image that will be created for the pause container. Default: "k8s.gcr.io/pause:3.1"
+Write the pod ID to the file
**--share**=""
@@ -69,9 +69,9 @@ for it. The name is useful any place you need to identify a pod.
# podman pod create --name test
-# podman pod create --pause=false
+# podman pod create --infra=false
-# podman pod create --pause-command /top
+# podman pod create --infra-command /top
## SEE ALSO
podman-pod(1)
diff --git a/libpod/container.go b/libpod/container.go
index 2e2d29899..28e451225 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -342,9 +342,9 @@ type ContainerConfig struct {
// It picks up the built-in volumes of the container used by --volumes-from
LocalVolumes []string
- // IsPause is a bool indicating whether this container is a pause container used for
+ // IsInfra is a bool indicating whether this container is an infra container used for
// sharing kernel namespaces in a pod
- IsPause bool `json:"pause"`
+ IsInfra bool `json:"pause"`
}
// ContainerStatus returns a string representation for users
@@ -974,7 +974,7 @@ func (c *Container) RootGID() int {
return 0
}
-// IsPause returns whether the container is a pause container
-func (c *Container) IsPause() bool {
- return c.config.IsPause
+// IsInfra returns whether the container is an infra container
+func (c *Container) IsInfra() bool {
+ return c.config.IsInfra
}
diff --git a/libpod/container_ffjson.go b/libpod/container_ffjson.go
index 02dc10e68..c35a72cb7 100644
--- a/libpod/container_ffjson.go
+++ b/libpod/container_ffjson.go
@@ -1,5 +1,5 @@
// Code generated by ffjson <https://github.com/pquerna/ffjson>. DO NOT EDIT.
-// source: libpod/container.go
+// source: /home/pehunt/go/src/github.com/containers/libpod/libpod/container.go
package libpod
@@ -517,7 +517,7 @@ func (j *ContainerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
} else {
buf.WriteString(`null`)
}
- if j.IsPause {
+ if j.IsInfra {
buf.WriteString(`,"pause":true`)
} else {
buf.WriteString(`,"pause":false`)
@@ -640,7 +640,7 @@ const (
ffjtContainerConfigLocalVolumes
- ffjtContainerConfigIsPause
+ ffjtContainerConfigIsInfra
)
var ffjKeyContainerConfigSpec = []byte("spec")
@@ -753,7 +753,7 @@ var ffjKeyContainerConfigExitCommand = []byte("exitCommand")
var ffjKeyContainerConfigLocalVolumes = []byte("LocalVolumes")
-var ffjKeyContainerConfigIsPause = []byte("pause")
+var ffjKeyContainerConfigIsInfra = []byte("pause")
// UnmarshalJSON umarshall json - template of ffjson
func (j *ContainerConfig) UnmarshalJSON(input []byte) error {
@@ -1060,8 +1060,8 @@ mainparse:
state = fflib.FFParse_want_colon
goto mainparse
- } else if bytes.Equal(ffjKeyContainerConfigIsPause, kn) {
- currentKey = ffjtContainerConfigIsPause
+ } else if bytes.Equal(ffjKeyContainerConfigIsInfra, kn) {
+ currentKey = ffjtContainerConfigIsInfra
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -1152,8 +1152,8 @@ mainparse:
}
- if fflib.EqualFoldRight(ffjKeyContainerConfigIsPause, kn) {
- currentKey = ffjtContainerConfigIsPause
+ if fflib.EqualFoldRight(ffjKeyContainerConfigIsInfra, kn) {
+ currentKey = ffjtContainerConfigIsInfra
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -1670,8 +1670,8 @@ mainparse:
case ffjtContainerConfigLocalVolumes:
goto handle_LocalVolumes
- case ffjtContainerConfigIsPause:
- goto handle_IsPause
+ case ffjtContainerConfigIsInfra:
+ goto handle_IsInfra
case ffjtContainerConfignosuchkey:
err = fs.SkipField(tok)
@@ -3973,9 +3973,9 @@ handle_LocalVolumes:
state = fflib.FFParse_after_value
goto mainparse
-handle_IsPause:
+handle_IsInfra:
- /* handler: j.IsPause type=bool kind=bool quoted=false*/
+ /* handler: j.IsInfra type=bool kind=bool quoted=false*/
{
if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
@@ -3991,11 +3991,11 @@ handle_IsPause:
if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
- j.IsPause = true
+ j.IsInfra = true
} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
- j.IsPause = false
+ j.IsInfra = false
} else {
err = errors.New("unexpected bytes for true/false value")
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index 18a8b9b83..7ed9f9be9 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -104,7 +104,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
IPv6Gateway: "",
MacAddress: "", // TODO
},
- IsPause: c.IsPause(),
+ IsInfra: c.IsInfra(),
}
// Copy port mappings into network settings
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index efd808b57..2267f69a1 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -178,7 +178,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
if err := pod.updatePod(); err != nil {
return nil, err
}
- podInfraContainer = pod.state.PauseContainerID
+ podInfraContainer = pod.state.InfraContainerID
}
}
diff --git a/libpod/options.go b/libpod/options.go
index c5e32d20e..b8f66db5c 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -304,32 +304,32 @@ func WithNamespace(ns string) RuntimeOption {
}
}
-// WithDefaultPauseImage sets the pause image for libpod.
-// A pause image is used for inter-container kernel
-// namespace sharing within a pod. Typically, a pause
+// WithDefaultInfraImage sets the infra image for libpod.
+// An infra image is used for inter-container kernel
+// namespace sharing within a pod. Typically, an infra
// container is lightweight and is there to reap
// zombie processes within its pid namespace.
-func WithDefaultPauseImage(img string) RuntimeOption {
+func WithDefaultInfraImage(img string) RuntimeOption {
return func(rt *Runtime) error {
if rt.valid {
return ErrRuntimeFinalized
}
- rt.config.PauseImage = img
+ rt.config.InfraImage = img
return nil
}
}
-// WithDefaultPauseCommand sets the command to
+// WithDefaultInfraCommand sets the command to
// run on pause container start up.
-func WithDefaultPauseCommand(cmd string) RuntimeOption {
+func WithDefaultInfraCommand(cmd string) RuntimeOption {
return func(rt *Runtime) error {
if rt.valid {
return ErrRuntimeFinalized
}
- rt.config.PauseCommand = cmd
+ rt.config.InfraCommand = cmd
return nil
}
@@ -1156,15 +1156,15 @@ func WithCtrNamespace(ns string) CtrCreateOption {
}
}
-// withIsPause sets the container to be a pause container. This means the container will be sometimes hidden
+// withIsInfra sets the container to be an infra container. This means the container will be sometimes hidden
// and expected to be the first container in the pod.
-func withIsPause() CtrCreateOption {
+func withIsInfra() CtrCreateOption {
return func(ctr *Container) error {
if ctr.valid {
return ErrCtrFinalized
}
- ctr.config.IsPause = true
+ ctr.config.IsInfra = true
return nil
}
@@ -1348,14 +1348,14 @@ func WithPodUTS() PodCreateOption {
}
}
-// WithPauseContainer tells the pod to create a pause container
-func WithPauseContainer() PodCreateOption {
+// WithInfraContainer tells the pod to create a pause container
+func WithInfraContainer() PodCreateOption {
return func(pod *Pod) error {
if pod.valid {
return ErrPodFinalized
}
- pod.config.PauseContainer.HasPauseContainer = true
+ pod.config.InfraContainer.HasInfraContainer = true
return nil
}
diff --git a/libpod/pod.go b/libpod/pod.go
index 627711cdb..f8c656920 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -55,7 +55,7 @@ type PodConfig struct {
UsePodUser bool `json:"sharesUser,omitempty"`
UsePodUTS bool `json:"sharesUts,omitempty"`
- PauseContainer *PauseContainerConfig `json:"pauseConfig"`
+ InfraContainer *InfraContainerConfig `json:"infraConfig"`
// Time pod was created
CreatedTime time.Time `json:"created"`
@@ -65,9 +65,9 @@ type PodConfig struct {
type podState struct {
// CgroupPath is the path to the pod's CGroup
CgroupPath string `json:"cgroupPath"`
- // PauseContainerID is the container that holds pod namespace information
- // Most often a pause container
- PauseContainerID string
+ // InfraContainerID is the container that holds pod namespace information
+ // Most often an infra container
+ InfraContainerID string
}
// PodInspect represents the data we want to display for
@@ -81,7 +81,7 @@ type PodInspect struct {
// PodInspectState contains inspect data on the pod's state
type PodInspectState struct {
CgroupPath string `json:"cgroupPath"`
- PauseContainerID string `json:"pauseContainerID"`
+ InfraContainerID string `json:"infraContainerID"`
}
// PodContainerInfo keeps information on a container in a pod
@@ -90,9 +90,9 @@ type PodContainerInfo struct {
State string `json:"state"`
}
-// PauseContainerConfig is the configuration for the pod's pause container
-type PauseContainerConfig struct {
- HasPauseContainer bool `json:"makePauseContainer"`
+// InfraContainerConfig is the configuration for the pod's infra container
+type InfraContainerConfig struct {
+ HasInfraContainer bool `json:"makeInfraContainer"`
}
// ID retrieves the pod's ID
@@ -219,20 +219,20 @@ func (p *Pod) allContainers() ([]*Container, error) {
return p.runtime.state.PodContainers(p)
}
-// HasPauseContainer returns whether the pod will create a pause container
-func (p *Pod) HasPauseContainer() bool {
- return p.config.PauseContainer.HasPauseContainer
+// HasInfraContainer returns whether the pod will create an infra container
+func (p *Pod) HasInfraContainer() bool {
+ return p.config.InfraContainer.HasInfraContainer
}
-// SharesNamespaces checks if the pod has any kernel namespaces set as shared. A pause container will not be
+// SharesNamespaces checks if the pod has any kernel namespaces set as shared. An infra container will not be
// created if no kernel namespaces are shared.
func (p *Pod) SharesNamespaces() bool {
return p.SharesPID() || p.SharesIPC() || p.SharesNet() || p.SharesMNT() || p.SharesUser() || p.SharesUTS()
}
-// PauseContainerID returns a the pause container ID for a pod.
-// If the container returned is "", the pod has no pause container.
-func (p *Pod) PauseContainerID() (string, error) {
+// InfraContainerID returns the infra container ID for a pod.
+// If the container returned is "", the pod has no infra container.
+func (p *Pod) InfraContainerID() (string, error) {
p.lock.Lock()
defer p.lock.Unlock()
@@ -240,7 +240,7 @@ func (p *Pod) PauseContainerID() (string, error) {
return "", err
}
- return p.state.PauseContainerID, nil
+ return p.state.InfraContainerID, nil
}
// TODO add pod batching
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 096c9b513..ebb8753b8 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -426,7 +426,7 @@ func (p *Pod) Inspect() (*PodInspect, error) {
}
podContainers = append(podContainers, pc)
}
- pauseContainerID := p.state.PauseContainerID
+ infraContainerID := p.state.InfraContainerID
if err != nil {
return &PodInspect{}, err
}
@@ -437,7 +437,7 @@ func (p *Pod) Inspect() (*PodInspect, error) {
Config: config,
State: &PodInspectState{
CgroupPath: p.state.CgroupPath,
- PauseContainerID: pauseContainerID,
+ InfraContainerID: infraContainerID,
},
Containers: podContainers,
}
diff --git a/libpod/pod_ffjson.go b/libpod/pod_ffjson.go
index a2030bb4c..65354f62a 100644
--- a/libpod/pod_ffjson.go
+++ b/libpod/pod_ffjson.go
@@ -12,7 +12,7 @@ import (
)
// MarshalJSON marshal bytes to json - template
-func (j *PauseContainerConfig) MarshalJSON() ([]byte, error) {
+func (j *InfraContainerConfig) MarshalJSON() ([]byte, error) {
var buf fflib.Buffer
if j == nil {
buf.WriteString("null")
@@ -26,7 +26,7 @@ func (j *PauseContainerConfig) MarshalJSON() ([]byte, error) {
}
// MarshalJSONBuf marshal buff to json - template
-func (j *PauseContainerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
+func (j *InfraContainerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
if j == nil {
buf.WriteString("null")
return nil
@@ -35,34 +35,34 @@ func (j *PauseContainerConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
var obj []byte
_ = obj
_ = err
- if j.HasPauseContainer {
- buf.WriteString(`{"makePauseContainer":true`)
+ if j.HasInfraContainer {
+ buf.WriteString(`{"makeInfraContainer":true`)
} else {
- buf.WriteString(`{"makePauseContainer":false`)
+ buf.WriteString(`{"makeInfraContainer":false`)
}
buf.WriteByte('}')
return nil
}
const (
- ffjtPauseContainerConfigbase = iota
- ffjtPauseContainerConfignosuchkey
+ ffjtInfraContainerConfigbase = iota
+ ffjtInfraContainerConfignosuchkey
- ffjtPauseContainerConfigHasPauseContainer
+ ffjtInfraContainerConfigHasInfraContainer
)
-var ffjKeyPauseContainerConfigHasPauseContainer = []byte("makePauseContainer")
+var ffjKeyInfraContainerConfigHasInfraContainer = []byte("makeInfraContainer")
// UnmarshalJSON umarshall json - template of ffjson
-func (j *PauseContainerConfig) UnmarshalJSON(input []byte) error {
+func (j *InfraContainerConfig) UnmarshalJSON(input []byte) error {
fs := fflib.NewFFLexer(input)
return j.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start)
}
// UnmarshalJSONFFLexer fast json unmarshall - template ffjson
-func (j *PauseContainerConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
+func (j *InfraContainerConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error {
var err error
- currentKey := ffjtPauseContainerConfigbase
+ currentKey := ffjtInfraContainerConfigbase
_ = currentKey
tok := fflib.FFTok_init
wantedTok := fflib.FFTok_init
@@ -108,7 +108,7 @@ mainparse:
kn := fs.Output.Bytes()
if len(kn) <= 0 {
// "" case. hrm.
- currentKey = ffjtPauseContainerConfignosuchkey
+ currentKey = ffjtInfraContainerConfignosuchkey
state = fflib.FFParse_want_colon
goto mainparse
} else {
@@ -116,21 +116,21 @@ mainparse:
case 'm':
- if bytes.Equal(ffjKeyPauseContainerConfigHasPauseContainer, kn) {
- currentKey = ffjtPauseContainerConfigHasPauseContainer
+ if bytes.Equal(ffjKeyInfraContainerConfigHasInfraContainer, kn) {
+ currentKey = ffjtInfraContainerConfigHasInfraContainer
state = fflib.FFParse_want_colon
goto mainparse
}
}
- if fflib.EqualFoldRight(ffjKeyPauseContainerConfigHasPauseContainer, kn) {
- currentKey = ffjtPauseContainerConfigHasPauseContainer
+ if fflib.EqualFoldRight(ffjKeyInfraContainerConfigHasInfraContainer, kn) {
+ currentKey = ffjtInfraContainerConfigHasInfraContainer
state = fflib.FFParse_want_colon
goto mainparse
}
- currentKey = ffjtPauseContainerConfignosuchkey
+ currentKey = ffjtInfraContainerConfignosuchkey
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -147,10 +147,10 @@ mainparse:
if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null {
switch currentKey {
- case ffjtPauseContainerConfigHasPauseContainer:
- goto handle_HasPauseContainer
+ case ffjtInfraContainerConfigHasInfraContainer:
+ goto handle_HasInfraContainer
- case ffjtPauseContainerConfignosuchkey:
+ case ffjtInfraContainerConfignosuchkey:
err = fs.SkipField(tok)
if err != nil {
return fs.WrapErr(err)
@@ -164,9 +164,9 @@ mainparse:
}
}
-handle_HasPauseContainer:
+handle_HasInfraContainer:
- /* handler: j.HasPauseContainer type=bool kind=bool quoted=false*/
+ /* handler: j.HasInfraContainer type=bool kind=bool quoted=false*/
{
if tok != fflib.FFTok_bool && tok != fflib.FFTok_null {
@@ -182,11 +182,11 @@ handle_HasPauseContainer:
if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {
- j.HasPauseContainer = true
+ j.HasInfraContainer = true
} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {
- j.HasPauseContainer = false
+ j.HasInfraContainer = false
} else {
err = errors.New("unexpected bytes for true/false value")
@@ -323,19 +323,19 @@ func (j *PodConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
}
buf.WriteByte(',')
}
- if j.PauseContainer != nil {
- buf.WriteString(`"pauseConfig":`)
+ if j.InfraContainer != nil {
+ buf.WriteString(`"infraConfig":`)
{
- err = j.PauseContainer.MarshalJSONBuf(buf)
+ err = j.InfraContainer.MarshalJSONBuf(buf)
if err != nil {
return err
}
}
} else {
- buf.WriteString(`"pauseConfig":null`)
+ buf.WriteString(`"infraConfig":null`)
}
buf.WriteString(`,"created":`)
@@ -380,7 +380,7 @@ const (
ffjtPodConfigUsePodUTS
- ffjtPodConfigPauseContainer
+ ffjtPodConfigInfraContainer
ffjtPodConfigCreatedTime
)
@@ -409,7 +409,7 @@ var ffjKeyPodConfigUsePodUser = []byte("sharesUser")
var ffjKeyPodConfigUsePodUTS = []byte("sharesUts")
-var ffjKeyPodConfigPauseContainer = []byte("pauseConfig")
+var ffjKeyPodConfigInfraContainer = []byte("infraConfig")
var ffjKeyPodConfigCreatedTime = []byte("created")
@@ -493,6 +493,11 @@ mainparse:
currentKey = ffjtPodConfigID
state = fflib.FFParse_want_colon
goto mainparse
+
+ } else if bytes.Equal(ffjKeyPodConfigInfraContainer, kn) {
+ currentKey = ffjtPodConfigInfraContainer
+ state = fflib.FFParse_want_colon
+ goto mainparse
}
case 'l':
@@ -516,14 +521,6 @@ mainparse:
goto mainparse
}
- case 'p':
-
- if bytes.Equal(ffjKeyPodConfigPauseContainer, kn) {
- currentKey = ffjtPodConfigPauseContainer
- state = fflib.FFParse_want_colon
- goto mainparse
- }
-
case 's':
if bytes.Equal(ffjKeyPodConfigUsePodCgroup, kn) {
@@ -570,8 +567,8 @@ mainparse:
goto mainparse
}
- if fflib.EqualFoldRight(ffjKeyPodConfigPauseContainer, kn) {
- currentKey = ffjtPodConfigPauseContainer
+ if fflib.SimpleLetterEqualFold(ffjKeyPodConfigInfraContainer, kn) {
+ currentKey = ffjtPodConfigInfraContainer
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -701,8 +698,8 @@ mainparse:
case ffjtPodConfigUsePodUTS:
goto handle_UsePodUTS
- case ffjtPodConfigPauseContainer:
- goto handle_PauseContainer
+ case ffjtPodConfigInfraContainer:
+ goto handle_InfraContainer
case ffjtPodConfigCreatedTime:
goto handle_CreatedTime
@@ -1175,22 +1172,22 @@ handle_UsePodUTS:
state = fflib.FFParse_after_value
goto mainparse
-handle_PauseContainer:
+handle_InfraContainer:
- /* handler: j.PauseContainer type=libpod.PauseContainerConfig kind=struct quoted=false*/
+ /* handler: j.InfraContainer type=libpod.InfraContainerConfig kind=struct quoted=false*/
{
if tok == fflib.FFTok_null {
- j.PauseContainer = nil
+ j.InfraContainer = nil
} else {
- if j.PauseContainer == nil {
- j.PauseContainer = new(PauseContainerConfig)
+ if j.InfraContainer == nil {
+ j.InfraContainer = new(InfraContainerConfig)
}
- err = j.PauseContainer.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
+ err = j.InfraContainer.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key)
if err != nil {
return err
}
@@ -2223,8 +2220,8 @@ func (j *PodInspectState) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
_ = err
buf.WriteString(`{"cgroupPath":`)
fflib.WriteJsonString(buf, string(j.CgroupPath))
- buf.WriteString(`,"pauseContainerID":`)
- fflib.WriteJsonString(buf, string(j.PauseContainerID))
+ buf.WriteString(`,"infraContainerID":`)
+ fflib.WriteJsonString(buf, string(j.InfraContainerID))
buf.WriteByte('}')
return nil
}
@@ -2235,12 +2232,12 @@ const (
ffjtPodInspectStateCgroupPath
- ffjtPodInspectStatePauseContainerID
+ ffjtPodInspectStateInfraContainerID
)
var ffjKeyPodInspectStateCgroupPath = []byte("cgroupPath")
-var ffjKeyPodInspectStatePauseContainerID = []byte("pauseContainerID")
+var ffjKeyPodInspectStateInfraContainerID = []byte("infraContainerID")
// UnmarshalJSON umarshall json - template of ffjson
func (j *PodInspectState) UnmarshalJSON(input []byte) error {
@@ -2311,18 +2308,18 @@ mainparse:
goto mainparse
}
- case 'p':
+ case 'i':
- if bytes.Equal(ffjKeyPodInspectStatePauseContainerID, kn) {
- currentKey = ffjtPodInspectStatePauseContainerID
+ if bytes.Equal(ffjKeyPodInspectStateInfraContainerID, kn) {
+ currentKey = ffjtPodInspectStateInfraContainerID
state = fflib.FFParse_want_colon
goto mainparse
}
}
- if fflib.EqualFoldRight(ffjKeyPodInspectStatePauseContainerID, kn) {
- currentKey = ffjtPodInspectStatePauseContainerID
+ if fflib.SimpleLetterEqualFold(ffjKeyPodInspectStateInfraContainerID, kn) {
+ currentKey = ffjtPodInspectStateInfraContainerID
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -2353,8 +2350,8 @@ mainparse:
case ffjtPodInspectStateCgroupPath:
goto handle_CgroupPath
- case ffjtPodInspectStatePauseContainerID:
- goto handle_PauseContainerID
+ case ffjtPodInspectStateInfraContainerID:
+ goto handle_InfraContainerID
case ffjtPodInspectStatenosuchkey:
err = fs.SkipField(tok)
@@ -2396,9 +2393,9 @@ handle_CgroupPath:
state = fflib.FFParse_after_value
goto mainparse
-handle_PauseContainerID:
+handle_InfraContainerID:
- /* handler: j.PauseContainerID type=string kind=string quoted=false*/
+ /* handler: j.InfraContainerID type=string kind=string quoted=false*/
{
@@ -2414,7 +2411,7 @@ handle_PauseContainerID:
outBuf := fs.Output.Bytes()
- j.PauseContainerID = string(string(outBuf))
+ j.InfraContainerID = string(string(outBuf))
}
}
@@ -2466,8 +2463,8 @@ func (j *podState) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
_ = err
buf.WriteString(`{"cgroupPath":`)
fflib.WriteJsonString(buf, string(j.CgroupPath))
- buf.WriteString(`,"PauseContainerID":`)
- fflib.WriteJsonString(buf, string(j.PauseContainerID))
+ buf.WriteString(`,"InfraContainerID":`)
+ fflib.WriteJsonString(buf, string(j.InfraContainerID))
buf.WriteByte('}')
return nil
}
@@ -2478,12 +2475,12 @@ const (
ffjtpodStateCgroupPath
- ffjtpodStatePauseContainerID
+ ffjtpodStateInfraContainerID
)
var ffjKeypodStateCgroupPath = []byte("cgroupPath")
-var ffjKeypodStatePauseContainerID = []byte("PauseContainerID")
+var ffjKeypodStateInfraContainerID = []byte("InfraContainerID")
// UnmarshalJSON umarshall json - template of ffjson
func (j *podState) UnmarshalJSON(input []byte) error {
@@ -2546,10 +2543,10 @@ mainparse:
} else {
switch kn[0] {
- case 'P':
+ case 'I':
- if bytes.Equal(ffjKeypodStatePauseContainerID, kn) {
- currentKey = ffjtpodStatePauseContainerID
+ if bytes.Equal(ffjKeypodStateInfraContainerID, kn) {
+ currentKey = ffjtpodStateInfraContainerID
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -2564,8 +2561,8 @@ mainparse:
}
- if fflib.EqualFoldRight(ffjKeypodStatePauseContainerID, kn) {
- currentKey = ffjtpodStatePauseContainerID
+ if fflib.SimpleLetterEqualFold(ffjKeypodStateInfraContainerID, kn) {
+ currentKey = ffjtpodStateInfraContainerID
state = fflib.FFParse_want_colon
goto mainparse
}
@@ -2596,8 +2593,8 @@ mainparse:
case ffjtpodStateCgroupPath:
goto handle_CgroupPath
- case ffjtpodStatePauseContainerID:
- goto handle_PauseContainerID
+ case ffjtpodStateInfraContainerID:
+ goto handle_InfraContainerID
case ffjtpodStatenosuchkey:
err = fs.SkipField(tok)
@@ -2639,9 +2636,9 @@ handle_CgroupPath:
state = fflib.FFParse_after_value
goto mainparse
-handle_PauseContainerID:
+handle_InfraContainerID:
- /* handler: j.PauseContainerID type=string kind=string quoted=false*/
+ /* handler: j.InfraContainerID type=string kind=string quoted=false*/
{
@@ -2657,7 +2654,7 @@ handle_PauseContainerID:
outBuf := fs.Output.Bytes()
- j.PauseContainerID = string(string(outBuf))
+ j.InfraContainerID = string(string(outBuf))
}
}
diff --git a/libpod/pod_internal.go b/libpod/pod_internal.go
index fb0b68906..46162c7ef 100644
--- a/libpod/pod_internal.go
+++ b/libpod/pod_internal.go
@@ -20,7 +20,7 @@ func newPod(lockDir string, runtime *Runtime) (*Pod, error) {
pod.config.ID = stringid.GenerateNonCryptoID()
pod.config.Labels = make(map[string]string)
pod.config.CreatedTime = time.Now()
- pod.config.PauseContainer = new(PauseContainerConfig)
+ pod.config.InfraContainer = new(InfraContainerConfig)
pod.state = new(podState)
pod.runtime = runtime
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 7e006b1fc..87b2d10a2 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -57,10 +57,10 @@ const (
// place of the configuration file pointed to by ConfigPath.
OverrideConfigPath = "/etc/containers/libpod.conf"
- // DefaultPauseImage to use for pause container
- DefaultPauseImage = "k8s.gcr.io/pause:3.1"
- // DefaultPauseCommand to be run in a pause container
- DefaultPauseCommand = "/pause"
+ // DefaultInfraImage to use for infra container
+ DefaultInfraImage = "k8s.gcr.io/pause:3.1"
+ // DefaultInfraCommand to be run in an infra container
+ DefaultInfraCommand = "/pause"
)
// A RuntimeOption is a functional option which alters the Runtime created by
@@ -157,10 +157,10 @@ type RuntimeConfig struct {
// and all containers and pods will be visible.
// The default namespace is "".
Namespace string `toml:"namespace,omitempty"`
- // PauseImage is the image a pod pause container will use to manage namespaces
- PauseImage string `toml:"pause_image"`
- // PauseCommand is the command run to start up a pod pause container
- PauseCommand string `toml:"pause_command"`
+ // InfraImage is the image a pod infra container will use to manage namespaces
+ InfraImage string `toml:"infra_image"`
+ // InfraCommand is the command run to start up a pod infra container
+ InfraCommand string `toml:"infra_command"`
}
var (
@@ -195,8 +195,8 @@ var (
NoPivotRoot: false,
CNIConfigDir: "/etc/cni/net.d/",
CNIPluginDir: []string{"/usr/libexec/cni", "/usr/lib/cni", "/opt/cni/bin"},
- PauseCommand: DefaultPauseCommand,
- PauseImage: DefaultPauseImage,
+ InfraCommand: DefaultInfraCommand,
+ InfraImage: DefaultInfraImage,
}
)
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 1aca559de..762044dbd 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -228,9 +228,9 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
return err
}
- pauseID := pod.state.PauseContainerID
- if c.ID() == pauseID {
- return errors.Errorf("a pause container cannot be removed without removing pod %s", pod.ID())
+ infraID := pod.state.InfraContainerID
+ if c.ID() == infraID {
+ return errors.Errorf("an infra container cannot be removed without removing pod %s", pod.ID())
}
}
diff --git a/libpod/runtime_pod_pause_linux.go b/libpod/runtime_pod_infra_linux.go
index 41bf8b041..9649a3138 100644
--- a/libpod/runtime_pod_pause_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -11,40 +11,40 @@ import (
const (
// IDTruncLength is the length of the pod's id that will be used to make the
- // pause container name
+ // infra container name
IDTruncLength = 12
)
-func (r *Runtime) makePauseContainer(ctx context.Context, p *Pod, imgName, imgID string) (*Container, error) {
+func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, imgID string) (*Container, error) {
- // Set up generator for pause container defaults
+ // Set up generator for infra container defaults
g, err := generate.New("linux")
if err != nil {
return nil, err
}
g.SetRootReadonly(true)
- g.SetProcessArgs([]string{r.config.PauseCommand})
+ g.SetProcessArgs([]string{r.config.InfraCommand})
containerName := p.ID()[:IDTruncLength] + "-infra"
var options []CtrCreateOption
options = append(options, r.WithPod(p))
options = append(options, WithRootFSFromImage(imgID, imgName, false))
options = append(options, WithName(containerName))
- options = append(options, withIsPause())
+ options = append(options, withIsInfra())
return r.newContainer(ctx, g.Config, options...)
}
-// createPauseContainer wrap creates a pause container for a pod.
-// A pause container becomes the basis for kernel namespace sharing between
+// createInfraContainer wrap creates an infra container for a pod.
+// An infra container becomes the basis for kernel namespace sharing between
// containers in the pod.
-func (r *Runtime) createPauseContainer(ctx context.Context, p *Pod) (*Container, error) {
+func (r *Runtime) createInfraContainer(ctx context.Context, p *Pod) (*Container, error) {
if !r.valid {
return nil, ErrRuntimeStopped
}
- newImage, err := r.ImageRuntime().New(ctx, r.config.PauseImage, "", "", nil, nil, image.SigningOptions{}, false, false)
+ newImage, err := r.ImageRuntime().New(ctx, r.config.InfraImage, "", "", nil, nil, image.SigningOptions{}, false, false)
if err != nil {
return nil, err
}
@@ -56,5 +56,5 @@ func (r *Runtime) createPauseContainer(ctx context.Context, p *Pod) (*Container,
imageName := newImage.Names()[0]
imageID := data.ID
- return r.makePauseContainer(ctx, p, imageName, imageID)
+ return r.makeInfraContainer(ctx, p, imageName, imageID)
}
diff --git a/libpod/runtime_pod_linux.go b/libpod/runtime_pod_linux.go
index eff15be76..b4530081c 100644
--- a/libpod/runtime_pod_linux.go
+++ b/libpod/runtime_pod_linux.go
@@ -87,25 +87,25 @@ func (r *Runtime) NewPod(ctx context.Context, options ...PodCreateOption) (*Pod,
if pod.config.UsePodCgroup {
logrus.Debugf("Got pod cgroup as %s", pod.state.CgroupPath)
}
- if pod.HasPauseContainer() != pod.SharesNamespaces() {
- return nil, errors.Errorf("Pods must have a pause container to share namespaces")
+ if pod.HasInfraContainer() != pod.SharesNamespaces() {
+ return nil, errors.Errorf("Pods must have an infra container to share namespaces")
}
if err := r.state.AddPod(pod); err != nil {
return nil, errors.Wrapf(err, "error adding pod to state")
}
- if pod.HasPauseContainer() {
- ctr, err := r.createPauseContainer(ctx, pod)
+ if pod.HasInfraContainer() {
+ ctr, err := r.createInfraContainer(ctx, pod)
if err != nil {
// Tear down pod, as it is assumed a the pod will contain
// a pause container, and it does not.
if err2 := r.removePod(ctx, pod, true, true); err2 != nil {
logrus.Errorf("Error removing pod after pause container creation failure: %v", err2)
}
- return nil, errors.Wrapf(err, "error adding Pause Container")
+ return nil, errors.Wrapf(err, "error adding Infra Container")
}
- pod.state.PauseContainerID = ctr.ID()
+ pod.state.InfraContainerID = ctr.ID()
if err := pod.save(); err != nil {
return nil, err
}
@@ -134,7 +134,7 @@ func (r *Runtime) removePod(ctx context.Context, p *Pod, removeCtrs, force bool)
if err := p.updatePod(); err != nil {
return err
}
- pauseCtrID := p.state.PauseContainerID
+ pauseCtrID := p.state.InfraContainerID
if numCtrs == 1 && ctrs[0].ID() == pauseCtrID {
removeCtrs = true
force = true
diff --git a/pkg/inspect/inspect.go b/pkg/inspect/inspect.go
index be3818db8..b9230027c 100644
--- a/pkg/inspect/inspect.go
+++ b/pkg/inspect/inspect.go
@@ -170,7 +170,7 @@ type ContainerInspectData struct {
NetworkSettings *NetworkSettings `json:"NetworkSettings"` //TODO
ExitCommand []string `json:"ExitCommand"`
Namespace string `json:"Namespace"`
- IsPause bool `json:"IsPause"`
+ IsInfra bool `json:"IsInfra"`
}
// ContainerInspectState represents the state of a container.
diff --git a/pkg/varlinkapi/pods.go b/pkg/varlinkapi/pods.go
index 657aa0baf..d95b631f2 100644
--- a/pkg/varlinkapi/pods.go
+++ b/pkg/varlinkapi/pods.go
@@ -21,14 +21,14 @@ func (i *LibpodAPI) CreatePod(call iopodman.VarlinkCall, create iopodman.PodCrea
if create.Name != "" {
options = append(options, libpod.WithPodName(create.Name))
}
- if len(create.Share) > 0 && !create.Pause {
- return call.ReplyErrorOccurred("You cannot share kernel namespaces on the pod level without a pause container")
+ if len(create.Share) > 0 && !create.Infra {
+ return call.ReplyErrorOccurred("You cannot share kernel namespaces on the pod level without an infra container")
}
- if len(create.Share) == 0 && create.Pause {
- return call.ReplyErrorOccurred("You must share kernel namespaces to run a pause container")
+ if len(create.Share) == 0 && create.Infra {
+ return call.ReplyErrorOccurred("You must share kernel namespaces to run an infra container")
}
- if create.Pause {
- options = append(options, libpod.WithPauseContainer())
+ if create.Infra {
+ options = append(options, libpod.WithInfraContainer())
nsOptions, err := shared.GetNamespaceOptions(create.Share)
if err != nil {
return err
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 019ba9377..8c9183450 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -32,7 +32,7 @@ var (
CGROUP_MANAGER = "systemd"
STORAGE_OPTIONS = "--storage-driver vfs"
ARTIFACT_DIR = "/tmp/.artifacts"
- CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, pause}
+ CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra}
RESTORE_IMAGES = []string{ALPINE, BB}
ALPINE = "docker.io/library/alpine:latest"
BB = "docker.io/library/busybox:latest"
@@ -41,7 +41,7 @@ var (
nginx = "quay.io/baude/alpine_nginx:latest"
redis = "docker.io/library/redis:alpine"
registry = "docker.io/library/registry:2"
- pause = "k8s.gcr.io/pause:3.1"
+ infra = "k8s.gcr.io/pause:3.1"
defaultWaitTimeout = 90
)
@@ -423,10 +423,10 @@ func (p *PodmanTest) RestoreAllArtifacts() error {
return nil
}
-// CreatePod creates a pod with no pause container
+// CreatePod creates a pod with no infra container
// it optionally takes a pod name
func (p *PodmanTest) CreatePod(name string) (*PodmanSession, int, string) {
- var podmanArgs = []string{"pod", "create", "--pause=false", "--share", ""}
+ var podmanArgs = []string{"pod", "create", "--infra=false", "--share", ""}
if name != "" {
podmanArgs = append(podmanArgs, "--name", name)
}
diff --git a/test/e2e/pod_pause_container_test.go b/test/e2e/pod_infra_container_test.go
index 09a1c18d0..2dcce6525 100644
--- a/test/e2e/pod_pause_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -23,7 +23,7 @@ var _ = Describe("Podman pod create", func() {
}
podmanTest = PodmanCreate(tempdir)
podmanTest.RestoreAllArtifacts()
- podmanTest.RestoreArtifact(pause)
+ podmanTest.RestoreArtifact(infra)
})
AfterEach(func() {
@@ -33,7 +33,7 @@ var _ = Describe("Podman pod create", func() {
GinkgoWriter.Write([]byte(timedResult))
})
- It("podman create pause container", func() {
+ It("podman create infra container", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -50,7 +50,7 @@ var _ = Describe("Podman pod create", func() {
Expect(len(check.OutputToStringArray())).To(Equal(1))
})
- It("podman start pause container", func() {
+ It("podman start infra container", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -66,7 +66,7 @@ var _ = Describe("Podman pod create", func() {
Expect(len(check.OutputToStringArray())).To(Equal(1))
})
- It("podman pause container namespaces", func() {
+ It("podman infra container namespaces", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -134,8 +134,8 @@ var _ = Describe("Podman pod create", func() {
Expect(len(PIDs)).To(Equal(4))
ctrPID, _ := strconv.Atoi(PIDs[1])
- pausePID, _ := strconv.Atoi(PIDs[2])
- Expect(ctrPID).To(BeNumerically("<", pausePID))
+ infraPID, _ := strconv.Atoi(PIDs[2])
+ Expect(ctrPID).To(BeNumerically("<", infraPID))
})
It("podman pod doesn't share PIDNS if requested to not", func() {
@@ -160,11 +160,11 @@ var _ = Describe("Podman pod create", func() {
check = podmanTest.Podman([]string{"top", podID[:12] + "-infra", "pid"})
check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(0))
- pauseTop := check.OutputToStringArray()
+ infraTop := check.OutputToStringArray()
ctrPID, _ := strconv.Atoi(ctrTop[1])
- pausePID, _ := strconv.Atoi(pauseTop[1])
- Expect(ctrPID).To(Equal(pausePID))
+ infraPID, _ := strconv.Atoi(infraTop[1])
+ Expect(ctrPID).To(Equal(infraPID))
})
It("podman pod container can override pod net NS", func() {
@@ -263,7 +263,7 @@ var _ = Describe("Podman pod create", func() {
Expect(PID1).To(Not(Equal(PID2)))
})
- It("podman pod pause container deletion", func() {
+ It("podman pod infra container deletion", func() {
session := podmanTest.Podman([]string{"pod", "create", "--share", "ipc"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -272,9 +272,9 @@ var _ = Describe("Podman pod create", func() {
session = podmanTest.Podman([]string{"ps", "-aq"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- pauseID := session.OutputToString()
+ infraID := session.OutputToString()
- session = podmanTest.Podman([]string{"rm", pauseID})
+ session = podmanTest.Podman([]string{"rm", infraID})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index b7f939aa9..c230c8973 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -43,12 +43,10 @@ var _ = Describe("Podman pod stats", func() {
})
It("podman stats on a specific running pod", func() {
- session := podmanTest.Podman([]string{"pod", "create"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- podid := session.OutputToString()
+ _, ec, podid := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
- session = podmanTest.RunTopContainerInPod("", podid)
+ session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -100,12 +98,10 @@ var _ = Describe("Podman pod stats", func() {
})
It("podman stats on running pods", func() {
- session := podmanTest.Podman([]string{"pod", "create"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- podid := session.OutputToString()
+ _, ec, podid := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
- session = podmanTest.RunTopContainerInPod("", podid)
+ session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -119,12 +115,10 @@ var _ = Describe("Podman pod stats", func() {
})
It("podman stats on all pods", func() {
- session := podmanTest.Podman([]string{"pod", "create"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- podid := session.OutputToString()
+ _, ec, podid := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
- session = podmanTest.RunTopContainerInPod("", podid)
+ session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -138,12 +132,10 @@ var _ = Describe("Podman pod stats", func() {
})
It("podman stats with json output", func() {
- session := podmanTest.Podman([]string{"pod", "create"})
- session.WaitWithDefaultTimeout()
- Expect(session.ExitCode()).To(Equal(0))
- podid := session.OutputToString()
+ _, ec, podid := podmanTest.CreatePod("")
+ Expect(ec).To(Equal(0))
- session = podmanTest.RunTopContainerInPod("", podid)
+ session := podmanTest.RunTopContainerInPod("", podid)
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))