]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
cephadm: mount host /etc/hosts for containers in podman deployments
authorAdam King <adking@redhat.com>
Sat, 21 Jan 2023 23:44:22 +0000 (18:44 -0500)
committerAdam King <adking@redhat.com>
Mon, 27 Mar 2023 18:01:11 +0000 (14:01 -0400)
commitdd8627bbe3ebc6d924912a37785859d8124f95e5
tree7f341621205b3d2cb8008dcdd0f59b50435b9913
parent043d4abccfba27dc0a2cbcd29a03cadabb342a16
cephadm: mount host /etc/hosts for containers in podman deployments

Podman messes with the /etc/hosts file in certain version. There
was already a past issue with it placing the container name
there fixed by https://github.com/ceph/ceph/pull/42242. This time
it is adding an entry for "host.containers.internal" (seems to be
podman 4.1 onward currently). Iscsi figures out the FQDN for a
host by running

python3 -c 'import socket; print(socket.getfqdn())

which is resolving to "host.containers.internal" when run in
the container with the podman modified /etc/hosts.

There is also an issue with grafana dashboard with
this entry present

Passing --no-hosts resolves this, but I think in the past
we avoided that due to not wanting to break deployments
where host name resolution was handled using /etc/hosts.
That's why we had that workaround previously linked. This
time I'm not sure such a workaround exists. The try here
is to mount a copy of the host's version of /etc/hosts
into the iscsi container. That copy won't have the extra
entry podman adds in but will have any user created entries in
case they were actually using it for host name resolution.
If /etc/hosts file isn't present for whatever reason, we're
assuming that this user isn't using /etc/hosts for hostname
resolution, and just going back to passing --no-hosts.

Fixes: https://tracker.ceph.com/issues/58532
Fixes: https://tracker.ceph.com/issues/57018
Signed-off-by: Adam King <adking@redhat.com>
src/cephadm/cephadm.py