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

[failed 26.0 backport - wrong branch] Restore the SetKey prestart hook. #47635

Merged

Conversation

robmry
Copy link
Contributor

@robmry robmry commented Mar 27, 2024

- What I did

Running SetKey to store the OCI Sandbox key after task creation, rather than from the OCI prestart hook, meant it happened after sysctl settings were applied by the runtime - which was the intention, we wanted to complete Sandbox configuration after IPv6 had been disabled by a sysctl if that was going to happen.

But, it meant '--sysctl' options for a specfic network interface caused container task creation to fail, because the interface is only moved into the network namespace during SetKey.

- How I did it

Restored the SetKey prestart hook.

Regenerate config files that depend on the container's support for IPv6 after the task has been created.

The changes in the second partially-reverted commit, to check IPv6 support before assigning an interface address/gateway would no longer work, but are no longer necessary. IPv6 addresses applied during the SetKey prestart hook will be removed when the sysctl disabling IPv6 in the container is applied.

- How to verify it

Added a regression test, to make sure it's possible to set an interface-specfic sysctl.

The tests for IPv6 addresses in '/etc/hosts' when IPv6 is disabled still work.

- Description for the changelog

Fix a regression that meant network interface specific `--sysctl` options prevented container startup.

Partially reverts 0046b16 "daemon: set libnetwork sandbox key w/o OCI hook"

Running SetKey to store the OCI Sandbox key after task creation, rather
than from the OCI prestart hook, meant it happened after sysctl settings
were applied by the runtime - which was the intention, we wanted to
complete Sandbox configuration after IPv6 had been disabled by a sysctl
if that was going to happen.

But, it meant '--sysctl' options for a specfic network interface caused
container task creation to fail, because the interface is only moved into
the network namespace during SetKey.

This change restores the SetKey prestart hook, and regenerates config
files that depend on the container's support for IPv6 after the task has
been created. It also adds a regression test that makes sure it's possible
to set an interface-specfic sysctl.

Signed-off-by: Rob Murray <rob.murray@docker.com>
@robmry robmry self-assigned this Mar 27, 2024
@robmry robmry added area/networking kind/bugfix PR's that fix bugs labels Mar 27, 2024
@robmry robmry added this to the 26.0.1 milestone Mar 27, 2024
@robmry robmry requested a review from akerouanton March 27, 2024 08:57
@robmry robmry marked this pull request as ready for review March 27, 2024 08:57
@robmry robmry changed the title Restore the SetKey prestart hook. [26.0 backport] Restore the SetKey prestart hook. Mar 27, 2024
Copy link
Member

@akerouanton akerouanton left a comment

Choose a reason for hiding this comment

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

LGTM

@akerouanton akerouanton merged commit a33b302 into moby:master Mar 28, 2024
138 checks passed
@robmry robmry removed this from the 26.0.1 milestone Mar 28, 2024
@robmry robmry changed the title [26.0 backport] Restore the SetKey prestart hook. [failed 26.0 backport - wrong branch] Restore the SetKey prestart hook. Mar 28, 2024
@robmry robmry deleted the backport-26.0/47619_restore_prestart_hook branch March 28, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

simple run command with --sysctl for network interface fails after upgrade
5 participants