Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerd: properly populate /etc/hosts and /etc/hostname #7041

Merged
merged 2 commits into from May 25, 2021
Merged

Conversation

muntac
Copy link
Contributor

@muntac muntac commented May 19, 2021

Changes proposed by this PR

cc: @chenbh

closes #6811

  • add hostname to /etc/hostname
  • add container's IP and hostname to /etc/hosts

Notes to reviewer

The container's IP is only available once the network has been initialized. Therefore, the original /etc/hosts has to be updated after. The /etc/hosts on the container is bindmounted to a file on the worker. We simply update this
file directly.

To test simply jump on to a running container and open the /etc/hosts and /etc/hostname file. You can also run hostname -f and hostname -i to validate.

Release Note

  • containerd: /etc/hosts and /etc/hostname are correctly populated

@muntac muntac requested a review from a team as a code owner May 19, 2021 21:27
The hostname is the container's handle. This is now added to /etc/hostname.

Both the hostname and the container's IP is appended to /etc/hosts. The
container's IP is only available once the network has been initialized.
Therefore, the original /etc/hosts has to be updated after. The /etc/hosts on
the container is bindmounted to a file on the worker.  We simply update this
file directly.

issue#6811

Co-authored-by: Muntasir Chowdhury <mchowdhury@pivotal.io>
Signed-off-by: Bohan Chen <bochen@pivotal.io>
worker/runtime/integration/integration_test.go Outdated Show resolved Hide resolved
worker/runtime/integration/integration_test.go Outdated Show resolved Hide resolved
worker/runtime/integration/integration_test.go Outdated Show resolved Hide resolved
worker/runtime/integration/integration_test.go Outdated Show resolved Hide resolved
Use already provided s.GardenBackend instead of creating custom backend.
Remove println used for debugging.

Signed-off-by: Muntasir Chowdhury <mchowdhury@pivotal.io>
Signed-off-by: Muntasir Chowdhury <muntasir.mzc@gmail.com>
Copy link
Member

@taylorsilva taylorsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@muntac
Copy link
Contributor Author

muntac commented May 25, 2021

Thanks! Good eye with the test cleanup suggestions.

@muntac muntac merged commit 6ed71d9 into master May 25, 2021
@muntac muntac deleted the issue/6811 branch May 25, 2021 16:43
@jaredstehler
Copy link

would it be possible to get this included in the next point release?

@steveburton4
Copy link

@taylorsilva Do you know when this is planned to be released?

@taylorsilva
Copy link
Member

Soon maybe? Looking at our milestone: https://github.com/concourse/concourse/milestone/75
It looks like we could probably cut another release soon.

@Christian-Oleson
Copy link

@jaredstehler ,
If I am reading this right it looks like this fix went out in the last release:
https://github.com/concourse/concourse/releases/tag/v7.4.0

@steveburton4
Copy link

@jaredstehler ,
If I am reading this right it looks like this fix went out in the last release:
https://github.com/concourse/concourse/releases/tag/v7.4.0

It did. We have installed it already and tested it fixes the issue we were having 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

containerd not populating /etc/hostname
6 participants