redpanda: set entrypoint to the custom entrypoint file#2347
redpanda: set entrypoint to the custom entrypoint file#2347mdelapenya merged 1 commit intotestcontainers:mainfrom bojand:main
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Hi @bojand, thanks for the PR. However, it is strange to me, that Podman and Docker behave different in this specific instance. So there are cases, where a |
|
I checked that we have the same situation in tc-java. For me it looks, like Podman does not handle setting an empty Entrypoint correctly (i.e. in the same way as Docker): If the Entrypoint is empty, the Cmd is supposed to become the Entrypoint (see Docker docs). While this PR would fix the issue for Podman users, we generally try to not perform Podman-specific changes, and rather prefer raising this as an issue with Podman (which is generally appreciated in bringing parity to Docker behavior). |
mdelapenya
left a comment
There was a problem hiding this comment.
Thanks @kiview for your review and coming with your insights.
LGTM
* main: feat: support for waiting for response headers (testcontainers#2349) chore(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (testcontainers#2392) redpanda: set entrypoint to the custom entrypoint file (testcontainers#2347)
What does this PR do?
Redpanda module has a custom entrypoint file
/entrypoint-tc.shthat waits until the actual Redpanda broker node config file is mounted.Then proceeds to call the normal Redpanda entryfile
/entrypoint.sh.The current implementation of the module sets the entrypoint file into the
Cmdof theContainerRequest.This seems to work with
Docker, but does not work withPodman.This results in an error when starting the container:
Since the intent is to override the entrypoint, we should be setting
Entrypointproperty as this is more appropriate.In more detail, if we inspect the Docker container:
{ "Id": "52d5be52543a60e793fa4920fd81794fe646fff06d917c96d56cbdf164475925", "Created": "2024-03-12T18:42:46.003923967Z", "Path": "/entrypoint-tc.sh", "Args": [ "redpanda", "start", "--mode=dev-container", "--smp=1", "--memory=1G" ], ... "Config": { "Hostname": "52d5be52543a", "Domainname": "", "User": "root:root", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "8081/tcp": {}, "8082/tcp": {}, "9092/tcp": {}, "9644/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "EDITOR=vi" ], "Cmd": [ "/entrypoint-tc.sh", "redpanda", "start", "--mode=dev-container", "--smp=1", "--memory=1G" ], "Image": "redpandadata/redpanda:v23.3.2", "Volumes": { "/var/lib/redpanda/data": {} }, "WorkingDir": "", "Entrypoint": [], "OnBuild": null, "Labels": { "org.opencontainers.image.authors": "Redpanda Data <hi@redpanda.com>", "org.testcontainers": "true", "org.testcontainers.lang": "go", "org.testcontainers.sessionId": "353c39fb1e5c8ee2313ec527210b4ab8fcda2274b067bd4d2360bff88574f774", "org.testcontainers.version": "0.28.0" } }, ... }But if we inspect the Podman container:
{ "Id": "3f9bb85cc4761e06082d7add0c02937439eba3d05ec1febf48ad09667b7abae5", "Created": "2024-03-12T19:05:31.255025847Z", "Path": "/entrypoint.sh", "Args": [ "/entrypoint-tc.sh", "redpanda", "start", "--mode=dev-container", "--smp=1", "--memory=1G" ], ... "Config": { "Hostname": "3f9bb85cc476", "Domainname": "", "User": "root:root", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "8081/tcp": {}, "8082/tcp": {}, "9092/tcp": {}, "9644/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "container=podman", "EDITOR=vi", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "HOME=/root", "HOSTNAME=3f9bb85cc476" ], "Cmd": [ "/entrypoint-tc.sh", "redpanda", "start", "--mode=dev-container", "--smp=1", "--memory=1G" ], "Image": "docker.io/redpandadata/redpanda:v23.3.2", "Volumes": null, "WorkingDir": "/", "Entrypoint": [ "/entrypoint.sh" ], "OnBuild": null, "Labels": { "org.opencontainers.image.authors": "Redpanda Data <hi@redpanda.com>", "org.testcontainers": "true", "org.testcontainers.lang": "go", "org.testcontainers.sessionId": "acef449fb3c94d212abe04df036b9e045292ce128eaf4a666f3d7340f9e421ad", "org.testcontainers.version": "0.28.0" }, "StopSignal": "15", "StopTimeout": 10 }, ... }We can see the Entrypoint for Podman container includes the stock Redpanda
entrypoint.sh.Why is it important?
It is more correct to override entrypoint this way.
How to test this PR
I have tested this change using Docker, and also using Podman, without changing code under test.
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE,TESTCONTAINERS_RYUK_CONTAINER_PRIVILEGED, andDOCKER_HOSTenv vars were set to accommodate proper running of Ryuk, and test environment. I ran into issues #2264 and #538.