-
-
Notifications
You must be signed in to change notification settings - Fork 866
containerd: add flag to add additional-hosts #9238
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, so easy! Was looking to see when /etc/hosts
gets added to the file store and found it here:
concourse/worker/runtime/cni_network.go
Lines 401 to 407 in 8419676
etcHosts, err := n.store.Create( | |
filepath.Join(handle, "/hosts"), | |
[]byte("127.0.0.1 localhost\n"), | |
) | |
if err != nil { | |
return nil, fmt.Errorf("creating /etc/hosts: %w", err) | |
} |
This looks good! Add the tests and this will be good to merge 🚀
Thanks for doing all the packaging stuff as well! ❤️ |
72f05cb
to
10cb05c
Compare
Signed-off-by: Kump3r <tonevkalin@gmail.com>
Signed-off-by: Kump3r <tonevkalin@gmail.com>
Signed-off-by: ceco556 <ceco456@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve tested this locally and it behaves as expected. Nice job! I’ve added a few small suggestions around error handling to help make it a bit more resilient.
Signed-off-by: Kump3r <tonevkalin@gmail.com>
Signed-off-by: Kump3r <tonevkalin@gmail.com>
Thanks for your feedback, we considered all of them previously as I mentioned, so it was a no brainer in adding them. It was just after a long day, so I totally messed up the previous unit tests 😅 |
You are absolutely right, when I was adjusting the tests, I switched the order and didn't think it matters as I forgot I already prepared the other packaging stuff. Nice catch! |
…ng missed test for IP verification failures Signed-off-by: Kump3r <tonevkalin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally with the following configurations:
- No
CONCOURSE_CONTAINERD_ADDITIONAL_HOSTS
set → ✅ no changes to containers, behaves as expected - Invalid values:
CONCOURSE_CONTAINERD_ADDITIONAL_HOSTS: 1.2.3.4 example.com,5.6.7.8.1 another-example.com
→ ✅ fails to create container and print appropriate error message - Valid values:
CONCOURSE_CONTAINERD_ADDITIONAL_HOSTS: 1.2.3.4 example.com,5.6.7.8 another-example.com
→ ✅ entries applied successfully to containers
Everything works as expected from my perspective - nice work!
Signed-off-by: Taylor Silva <dev@taydev.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickly repeated Ivan's tests and got the same results. I added an additional commit that clarifies the format we expect the IP and hostname to be passed in with.
Will let the PR checks go through one last time and then merge.
Thanks guys! Feel free to check the packaging stuff as they should be pretty straightforward as well. |
Changes proposed by this PR
Based on #6549, we want to maintain the adopt the functionally of adding additional DNS host entries to the
/etc/hosts
file of the container.CONCOURSE_CONTAINERD_ADDITIONAL_HOSTS
Notes to reviewer
N/A