summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-11-08 14:29:44 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-11-15 12:53:25 +0100
commit5934e4c9b50020e0099a71233ae4f9ba9356215f (patch)
tree5bb45e72e727080a10574b6be60b881fb3a34d6f
parent58cf0d4622ea280382dccdb527c483afd3f16562 (diff)
downloadpodman-5934e4c9b50020e0099a71233ae4f9ba9356215f.tar.gz
podman-5934e4c9b50020e0099a71233ae4f9ba9356215f.tar.bz2
podman-5934e4c9b50020e0099a71233ae4f9ba9356215f.zip
infra container: replace pause with catatonit
Podman has been using catatonit for a number of years already. Thanks to @giuseppe, catatonit is now able to run as a pause process which allows us to replace the pause binary entirely. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r--contrib/spec/podman.spec.in1
-rw-r--r--pkg/specgen/generate/pod_create.go13
-rw-r--r--test/apiv2/40-pods.at4
-rw-r--r--test/e2e/pod_create_test.go4
4 files changed, 10 insertions, 12 deletions
diff --git a/contrib/spec/podman.spec.in b/contrib/spec/podman.spec.in
index 95c3cb5e2..cb041df6c 100644
--- a/contrib/spec/podman.spec.in
+++ b/contrib/spec/podman.spec.in
@@ -58,6 +58,7 @@ BuildRequires: libselinux-devel
BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: systemd-devel
+Requires: catatonit >= 0.1.7
Requires: containers-common
Requires: conmon
Requires: containernetworking-plugins >= 0.6.0-3
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index bfd81739a..72dd249e7 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -29,19 +29,16 @@ func buildPauseImage(rt *libpod.Runtime, rtConfig *config.Config) (string, error
return imageName, nil
}
- // NOTE: Having the pause binary in its own directory keeps the door
- // open for replacing the image building with using an overlay root FS.
- // The latter turned out to be complex and error prone (see #11956) but
- // we may be able to come up with a proper solution at a later point in
- // time.
- pausePath, err := rtConfig.FindHelperBinary("pause/pause", false)
+ // Also look into the path as some distributions install catatonit in
+ // /usr/bin.
+ catatonitPath, err := rtConfig.FindHelperBinary("catatonit", true)
if err != nil {
return "", fmt.Errorf("finding pause binary: %w", err)
}
buildContent := fmt.Sprintf(`FROM scratch
-COPY %s /pause
-ENTRYPOINT ["/pause"]`, pausePath)
+COPY %s /catatonit
+ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)
tmpF, err := ioutil.TempFile("", "pause.containerfile")
if err != nil {
diff --git a/test/apiv2/40-pods.at b/test/apiv2/40-pods.at
index f45e85f61..0a5201213 100644
--- a/test/apiv2/40-pods.at
+++ b/test/apiv2/40-pods.at
@@ -110,11 +110,11 @@ t GET libpod/pods/fakename/top 404 \
.cause="no such pod"
t GET libpod/pods/foo/top 200 \
- .Processes[0][-1]="/pause" \
+ .Processes[0][-1]="/catatonit -P" \
.Titles[-1]="COMMAND"
t GET libpod/pods/foo/top?ps_args=args,pid 200 \
- .Processes[0][0]="/pause" \
+ .Processes[0][0]="/catatonit -P" \
.Processes[0][1]="1" \
.Titles[0]="COMMAND" \
.Titles[1]="PID" \
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 12aeffd1b..f5a2caad7 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -369,13 +369,13 @@ var _ = Describe("Podman pod create", func() {
check1 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Config.Entrypoint}}", data.Containers[0].ID})
check1.WaitWithDefaultTimeout()
Expect(check1).Should(Exit(0))
- Expect(check1.OutputToString()).To(Equal("/pause"))
+ Expect(check1.OutputToString()).To(Equal("/catatonit -P"))
// check the Path and Args
check2 := podmanTest.Podman([]string{"container", "inspect", "--format", "{{.Path}}:{{.Args}}", data.Containers[0].ID})
check2.WaitWithDefaultTimeout()
Expect(check2).Should(Exit(0))
- Expect(check2.OutputToString()).To(Equal("/pause:[/pause]"))
+ Expect(check2.OutputToString()).To(Equal("/catatonit:[-P]"))
})
It("podman create pod with --infra-command", func() {