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

kubernetes: move dockershim link to relative path #18

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

yeazelm
Copy link
Contributor

@yeazelm yeazelm commented Jun 27, 2024

Issue number: bottlerocket-os/bottlerocket#4074

Closes # bottlerocket-os/bottlerocket#4074

Description of changes:
The link created for dockershim.sock was an absolute path which worked fine until that link is mounted into a container under a different path. This would break use cases where the container needs to follow that link to get to the containerd socket. This commit moves to a relative symlink so that this will work via paths such as /host/run/dockershim.sock.

Testing done:
I tested the specific use case of datadog where the agent code was failing to follow the link, before:

CORE | ERROR | (pkg/util/containerd/containerd_util.go:109 in NewContainerdUtil) | Containerd init error: temporary failure in containerdutil, will retry later: failed to dial "/host/run/dockershim.sock": context deadline exceeded

after this change, the agent doesn't emit this failure.

The link can be followed now from within the container, before:

file /host/run/dockershim.sock
/host/run/dockershim.sock: broken symbolic link to /run/containerd/containerd.sock

after:

# file /host/run/dockershim.sock
/host/run/dockershim.sock: symbolic link to ./containerd/containerd.sock

You can still use the file from within the host as well:

# First the actual socket
bash-5.1# ctr -a /run/containerd/containerd.sock version
Client:
  Version:  1.7.17+bottlerocket
  Revision: 3a4de459a68952ffb703bbe7f2290861a75b6b67
  Go version: go1.21.11

Server:
  Version:  1.7.17+bottlerocket
  Revision: 3a4de459a68952ffb703bbe7f2290861a75b6b67
  UUID: a7389acf-5e78-4206-94a2-cec58057cfda

# Then the link
bash-5.1# ctr -a /run/dockershim.sock version
Client:
  Version:  1.7.17+bottlerocket
  Revision: 3a4de459a68952ffb703bbe7f2290861a75b6b67
  Go version: go1.21.11

Server:
  Version:  1.7.17+bottlerocket
  Revision: 3a4de459a68952ffb703bbe7f2290861a75b6b67
  UUID: a7389acf-5e78-4206-94a2-cec58057cfda

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

The link created for dockershim.sock was an absolute path which worked
fine until that link is mounted into a container under a different path.
This would break use cases where the container needs to follow that link
to get to the containerd socket. This commit moves to a relative symlink
so that this will work via paths such as /host/run/dockershim.sock.
Copy link
Member

@larvacea larvacea left a comment

Choose a reason for hiding this comment

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

Looks as if it does exactly what you claimed.

@yeazelm yeazelm merged commit e4f9f14 into bottlerocket-os:develop Jun 30, 2024
2 checks passed
@yeazelm yeazelm deleted the its_all_relative branch June 30, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants