Skip to content

fix(network): skip sysctl/modprobe on non-Linux in NoopNetworkPlugin - #564

Open
AruneshDwivedi wants to merge 2 commits into
Mirantis:masterfrom
AruneshDwivedi:fix/noop-plugin-windows-sysctl
Open

fix(network): skip sysctl/modprobe on non-Linux in NoopNetworkPlugin#564
AruneshDwivedi wants to merge 2 commits into
Mirantis:masterfrom
AruneshDwivedi:fix/noop-plugin-windows-sysctl

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

NoopNetworkPlugin.Init runs modprobe br-netfilter and sets bridge sysctls unconditionally, which fails on Windows hosts using --network-plugin no-op. Skip them on non-Linux. Fixes #531

NoopNetworkPlugin.Init runs modprobe br-netfilter and sets bridge sysctls
unconditionally, which fails on Windows hosts using --network-plugin no-op.
These Linux-specific operations are only needed when containers connect to
Linux bridges, so skip them entirely on non-Linux platforms.

Fixes Mirantis#531

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the built-in NoopNetworkPlugin initialization to avoid running Linux-specific modprobe and bridge sysctl configuration when cri-dockerd is executed on non-Linux hosts (notably Windows) with --network-plugin no-op, addressing issue #531.

Changes:

  • Add a runtime OS check in NoopNetworkPlugin.Init to return early on non-Linux platforms.
  • Prevents non-fatal but noisy errors from attempting to access Linux /proc/sys/... paths on Windows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread network/plugins.go
Comment on lines +221 to +223
if runtime.GOOS != "linux" {
return nil
}
Verifies that Init returns immediately on non-Linux platforms without
touching the sysctl interface. If the Linux-only path were reached, it
would panic because Sysctl is nil.
@AruneshDwivedi

Copy link
Copy Markdown
Author

Added a build-tagged test (plugins_nonlinux_test.go, //go:build windows) that verifies Init returns immediately without touching Sysctl. If the Linux path were reached it would panic since Sysctl is nil.

@awmirantis awmirantis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thanks

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.

Running with "no-op" network plugin tries to run Linux command on Windows

3 participants