summaryrefslogtreecommitdiff
path: root/libpod
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 /libpod
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
Diffstat (limited to 'libpod')
-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
13 files changed, 158 insertions, 161 deletions
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