Skip to content

Remove CNI for podman6#412

Merged
Luap99 merged 9 commits intocontainers:mainfrom
lsm5:podman6-no-cni
Mar 16, 2026
Merged

Remove CNI for podman6#412
Luap99 merged 9 commits intocontainers:mainfrom
lsm5:podman6-no-cni

Conversation

@lsm5
Copy link
Member

@lsm5 lsm5 commented Oct 22, 2025

See individual commits.

This is vendored into containers/buildah#6453 and containers/podman#28202

@github-actions github-actions bot added the common Related to "common" package label Oct 22, 2025
@lsm5 lsm5 changed the title Remove CNI for podman6 [WIP] Remove CNI for podman6 Oct 22, 2025
@packit-as-a-service
Copy link

Packit jobs failed. @containers/packit-build please check.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

mostly looks good, commit structure is good and helped for the reviews, thanks.

}

func defaultNetworkBackend(store storage.Store, conf *config.Config) (backend types.NetworkBackend, err error) {
func defaultNetworkBackend(store storage.Store, _ *config.Config) (backend types.NetworkBackend, err error) {
Copy link
Member

Choose a reason for hiding this comment

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

we should be able to just delete this, no need to mess with the state file at all

basically in the main function if backend == "" || backend == netavark then return netavark anything else return hard error, no need to have anything more if we do not need it

TmpDir: opts.Config.Engine.TmpDir,
ChildIP: childIP,
ContainerID: opts.ContainerID,
RootlessCNI: netStatus != nil,
Copy link
Member

Choose a reason for hiding this comment

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

I think this is still needed at least as long slirp4netns support is still in the code base, this bool is for the rootless bridge networking, it just comes from a time where we never renamed it.

we need this to remap the source ip of rootlessport via the extrac socket that rootlessport exposes in the podman repo.

This can go away once we fully get rid of slirp and rootlessport but not as part of CNI removal.

Comment on lines +150 to +155
func getCurrentThreadNetNSPath() string {
// /proc/self/ns/net returns the namespace of the main thread, not
// of whatever thread this goroutine is running on. Make sure we
// use the thread's net namespace since the thread is switching around
return fmt.Sprintf("/proc/%d/task/%d/ns/net", os.Getpid(), unix.Gettid())
}
Copy link
Member

Choose a reason for hiding this comment

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

see 4914fe7 we should not reimport that one

overall I think inlining this logic here makes sense

@lsm5 lsm5 changed the title [WIP] Remove CNI for podman6 Remove CNI for podman6 Mar 12, 2026
@lsm5 lsm5 marked this pull request as ready for review March 12, 2026 12:52
@lsm5
Copy link
Member Author

lsm5 commented Mar 12, 2026

@Luap99 comments addressed.

@containers/container-libs-maintainers PTAL

@mheon
Copy link
Member

mheon commented Mar 12, 2026

LGTM

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

I have no opinion on whether we want to do this but the implementation of that decision looks good.

  • Also common/.golangci.yml still contains a CNI flag
  • A commit message says “Systems that previously used CNI are automatically migrated to netavark via the defaultNetworkBackend sentinel file.”, but all of that code was removed.
  • (I don’t have much of an opinion on the ordering of code in netns_linux.go but I spent quite a lot of time determining the correspondence between the original and the copy. A separate commit copying ~unmodified code, and then reordering, would have been easier to review.)

@lsm5 lsm5 marked this pull request as draft March 13, 2026 11:43
@lsm5
Copy link
Member Author

lsm5 commented Mar 13, 2026

Addressed comments, but I'll take a bit to vendor the latest into buildah and podman before removing draft status. You're welcome to review this though.

Copy link
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

LGTM, please merge whenever appropriate.

lsm5 added 8 commits March 16, 2026 15:26
Drop the build-amd64-cni target and cni-tagged unit tests from the
Makefile as part of removing CNI support in favor of netavark-only
networking for Podman 6.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Remove the CNI-tagged interface files and simplify NetworkBackend()
to only support netavark. Any other backend value results in an error.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Remove the NetworkBackend type and CNI constants from rootlessnetns,
drop the CNI /var/lib/cni mount logic, and update comments throughout.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Remove the CNI network backend constant, CNIPluginDirs config field,
DefaultCNIPluginDirs variable, and cni_plugin_dirs from config files
and tests.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Delete the entire libnetwork/cni/ directory including all source files,
tests, and test fixtures.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Copy the NetNS interface, netNS struct, GetNS(), WithNetNSPath(),
GetCurrentNS(), and related types from the vendored
containernetworking/plugins/pkg/ns package into common/pkg/netns.
Update all consumers to import from common/pkg/netns instead.

This removes the runtime dependency on containernetworking/plugins
for network namespace management.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Move the NetNS interface, netNS struct, and related types and methods
above the existing netns functions so that type definitions precede
their usage. No functional changes.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Remove github.com/containernetworking/cni and
github.com/containernetworking/plugins from go.mod and vendor.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Update containers.conf.5.md to reflect netavark-only networking and
remove cni_plugin_dirs documentation. Clean up remaining CNI references
in netavark test file comments.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
@lsm5 lsm5 marked this pull request as ready for review March 16, 2026 11:09
@lsm5
Copy link
Member Author

lsm5 commented Mar 16, 2026

Linked buildah and podman PRs have passing tests apart from the likely unrelated compose and machine test failures. I think I've addressed all comments on this PR too. Removing draft status from here. PTAL @containers/container-libs-maintainers

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@Luap99 Luap99 merged commit ebc3448 into containers:main Mar 16, 2026
17 checks passed
@lsm5 lsm5 deleted the podman6-no-cni branch March 17, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants