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

Per-interface sysctls #47686

Merged
merged 3 commits into from
May 29, 2024
Merged

Commits on May 17, 2024

  1. Factor out selection of endpoint for config migration

    Signed-off-by: Rob Murray <rob.murray@docker.com>
    robmry committed May 17, 2024
    Configuration menu
    Copy the full SHA
    a35716f View commit details
    Browse the repository at this point in the history
  2. Move EndpointSettings.DriverOpts from op-state to config

    Signed-off-by: Rob Murray <rob.murray@docker.com>
    robmry committed May 17, 2024
    Configuration menu
    Copy the full SHA
    1e29f9b View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Add per-endpoint sysctls to DriverOpts

    Until now it's been possible to set per-interface sysctls using, for
    example, '--sysctl net.ipv6.conf.eth0.accept_ra=2'. But, the index in
    the interface name is allocated serially, and the numbering in a container
    with more than one interface may change when a container is restarted.
    The change to make it possible to connect a container to more than one
    network when it's created increased the ambiguity.
    
    This change adds label "com.docker.network.endpoint.sysctls" to the
    DriverOpts in EndpointSettings. This option is explicitly associated
    with the interface.
    
    Settings in "--sysctl" for "eth0" are migrated to DriverOpts.
    
    Because using "--sysctl" with any interface apart from "eth0" would have
    unpredictable results, it is now an error to use any other interface name
    in the top level "--sysctl" option. The error message includes a hint at
    how to use the new per-interface setting.
    
    The per-endpoint sysctl name has the interface name replaced by
    "IFNAME". For example:
        net.ipv6.conf.eth0.accept_ra=2
    becomes:
        net.ipv6.conf.IFNAME.accept_ra=2
    
    The value of DriverOpts["com.docker.network.endpoint.sysctls"] is a
    comma separated list.
    
    Settings from '--sysctl' are applied by the runtime lib during task
    creation. So, task creation fails if the endpoint does not exist.
    Applying per-endpoint settings during interface configuration means the
    endpoint can be created later, which paves the way for removal of the
    SetKey OCI prestart hook.
    
    Unlike other DriverOpts, the sysctl label itself is not driver-specific,
    but each driver has a chance to check settings/values and raise an error
    if a setting would cause it a problem - no such checks have been added
    in this initial version. As a future extension, if required, it would be
    possible for the driver to echo back valid/extended/modified settings to
    libnetwork for it to apply to the interface. (At that point, the syntax
    for the options could become driver specific to allow, for example, a
    driver to create more than one interface).
    
    Signed-off-by: Rob Murray <rob.murray@docker.com>
    robmry committed May 29, 2024
    Configuration menu
    Copy the full SHA
    0071832 View commit details
    Browse the repository at this point in the history