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

Skip loading openvswitch Kernel module if built-in #5979

Merged

Conversation

antoninbas
Copy link
Contributor

@antoninbas antoninbas commented Feb 10, 2024

If a module is built-in, trying to load the module with modprobe inside a container may fail (insted of just being a no-op). This will cause Antrea initialization to fail unless agent.dontLoadKernelModules is explicitly set to true.

Now that the Docker Desktop LinuxKit VM comes with openvswitch built-in (starting with 4.27.0), trying to install "default" Antrea (i.e., without setting agent.dontLoadKernelModules) in a Kind cluster running with Docker Desktop on macOS will fail. To make sure that users will not run into this issue, we add logic to the install_cni script to skip the modprobe call if the module is built-in.

After this change, there should be very limited use cases for the agent.dontLoadKernelModules parameter, but there is no harm in keeping in case it is needed in the future or for some corner cases.

I also realized that the "--skip-kmod" flag for the start_ovs script did not provide any value. Either the openvswitch module needs to be explicitly loaded, in which case the install_cni script will take care of it anyway, or it should not be loaded at all (e.g., because it is built-in). Additionally, because we do not mount the host's /lib/modules to the antrea-ovs container, it is not possible to load any kernel module from the container.

Fixes #5939

If a module is built-in, trying to load the module with modprobe inside
a container may fail (insted of just being a no-op). This will cause
Antrea initialization to fail unless agent.dontLoadKernelModules is
explicitly set to true.

Now that the Docker Desktop LinuxKit VM comes with openvswitch built-in
(starting with 4.27.0), trying to install "default" Antrea (i.e.,
without setting agent.dontLoadKernelModules) in a Kind cluster running
with Docker Desktop on macOS will fail. To make sure that users will not
run into this issue, we add logic to the install_cni script to skip the
modprobe call if the module is built-in.

After this agent, there should be very limited use cases for the
agent.dontLoadKernelModules parameter, but there is no harm in keeping
in case it is needed in the future or for some corner cases.

I also realized that the "--skip-kmod" flag for the start_ovs script did
not provide any value. Either the openvswitch module needs to be
explicitly loaded, in which case the install_cni script will take care
of it anyway, or it should not be loaded at all (e.g., because it is
built-in). Additionally, because we do not mount the host's /lib/modules
to the antrea-ovs container, it is not possible to load any kernel
module from the container.

Fixes antrea-io#5939

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
@antoninbas antoninbas requested a review from tnqn February 10, 2024 02:07
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

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

Code LGTM.
Do you mean "After this change" by "After this agent" in the commit message?

@antoninbas antoninbas added action/backport Indicates a PR that requires backports. action/release-note Indicates a PR that should be included in release notes. labels Feb 20, 2024
@antoninbas
Copy link
Contributor Author

Code LGTM. Do you mean "After this change" by "After this agent" in the commit message?

Yes :) I'll fix the commit when I merge

@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas antoninbas merged commit eaf8e26 into antrea-io:main Feb 21, 2024
50 of 55 checks passed
@antoninbas antoninbas deleted the skip-loading-kernel-module-if-builtin branch February 21, 2024 01:06
@antoninbas
Copy link
Contributor Author

I will only backport this change to 1.15, for the following reasons:

  • reduce risk for other releases because of change in behavior
  • it addresses a very specific scenario (very recent Docker Desktop versions)
  • users can set agent.dontLoadKernelModules=true as a workaround if they experience the issue in their environment with older Antrea versions

antoninbas added a commit to antoninbas/antrea that referenced this pull request Feb 21, 2024
If a module is built-in, trying to load the module with modprobe inside
a container may fail (insted of just being a no-op). This will cause
Antrea initialization to fail unless agent.dontLoadKernelModules is
explicitly set to true.

Now that the Docker Desktop LinuxKit VM comes with openvswitch built-in
(starting with 4.27.0), trying to install "default" Antrea (i.e.,
without setting agent.dontLoadKernelModules) in a Kind cluster running
with Docker Desktop on macOS will fail. To make sure that users will not
run into this issue, we add logic to the install_cni script to skip the
modprobe call if the module is built-in.

After this change, there should be very limited use cases for the
agent.dontLoadKernelModules parameter, but there is no harm in keeping
in case it is needed in the future or for some corner cases.

I also realized that the "--skip-kmod" flag for the start_ovs script did
not provide any value. Either the openvswitch module needs to be
explicitly loaded, in which case the install_cni script will take care
of it anyway, or it should not be loaded at all (e.g., because it is
built-in). Additionally, because we do not mount the host's /lib/modules
to the antrea-ovs container, it is not possible to load any kernel
module from the container.

Fixes antrea-io#5939

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
antoninbas added a commit that referenced this pull request Feb 22, 2024
If a module is built-in, trying to load the module with modprobe inside
a container may fail (insted of just being a no-op). This will cause
Antrea initialization to fail unless agent.dontLoadKernelModules is
explicitly set to true.

Now that the Docker Desktop LinuxKit VM comes with openvswitch built-in
(starting with 4.27.0), trying to install "default" Antrea (i.e.,
without setting agent.dontLoadKernelModules) in a Kind cluster running
with Docker Desktop on macOS will fail. To make sure that users will not
run into this issue, we add logic to the install_cni script to skip the
modprobe call if the module is built-in.

After this change, there should be very limited use cases for the
agent.dontLoadKernelModules parameter, but there is no harm in keeping
in case it is needed in the future or for some corner cases.

I also realized that the "--skip-kmod" flag for the start_ovs script did
not provide any value. Either the openvswitch module needs to be
explicitly loaded, in which case the install_cni script will take care
of it anyway, or it should not be loaded at all (e.g., because it is
built-in). Additionally, because we do not mount the host's /lib/modules
to the antrea-ovs container, it is not possible to load any kernel
module from the container.

Fixes #5939

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/backport Indicates a PR that requires backports. action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Antrea no longer works with Kind after upgrading to Docker Desktop 4.27.0
2 participants