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

CNI dhcp plugin does not work - netns bind issues #2925

Open
dtrudg opened this issue May 16, 2024 · 0 comments
Open

CNI dhcp plugin does not work - netns bind issues #2925

dtrudg opened this issue May 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@dtrudg
Copy link
Member

dtrudg commented May 16, 2024

Version of Singularity

main / 4.1

Describe the bug

If a CNI plugin is run using dhcp IPAM, two portions of the dhcp plugin are in play:

  • The dhcp client plugin is used to setup the container network namespace.
  • The dhcp plugin daemon is run on the host, and will hold / renew reservations for addresses consumed by containers.

The dhcp client plugin will communicate with the daemon, and pass the path to a bound network namespace associated with the container. The daemon requires access to this network namespace.

When setting up CNI networks we currently:

  • Add a bind point from /proc/self/ns/net into the singularity session directory.
  • Call the CNI network setup using the path in the session directory.

There are two problems here:

  • The bind is not actually applied at CNI setup time, leading to an error such as:

    FATAL:   container creation failed: plugin type="macvlan" failed (add): error calling DHCP.Allocate: failed to Statfs "/usr/local/var/singularity/mnt/session/netns": no such file or directory
    
  • The session directory is not accessible to the dhcp daemon on the host, so it cannot access the container's network namespace.

To support the dhcp plugin we must:

  • Bind mount the network namespace to a location that is shared with / accessible from the host - not only inside the per-container session mount namespace.
  • Ensure the bind happens before the dhcp plugin is called, and that the correct path is passed through to the plugin, which will in turn pass it to the dhcp daemon on the host.
@dtrudg dtrudg added the bug Something isn't working label May 16, 2024
@dtrudg dtrudg added this to the SingularityCE 4.2.0 milestone May 16, 2024
@dtrudg dtrudg self-assigned this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant