Skip to content

Commit 17c93dc

Browse files
authored
Merge pull request #2725 from AkihiroSuda/netmgr-remove-unused-var
cniNetworkManager: move Windows-specific variable to `_windows.go`
2 parents 0917d4e + 695f11a commit 17c93dc

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

pkg/containerutil/container_network_manager.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/containerd/containerd"
3131
"github.com/containerd/containerd/containers"
3232
"github.com/containerd/containerd/oci"
33-
"github.com/containerd/containerd/pkg/netns"
3433
"github.com/containerd/nerdctl/pkg/api/types"
3534
"github.com/containerd/nerdctl/pkg/clientutil"
3635
"github.com/containerd/nerdctl/pkg/dnsutil/hostsstore"
@@ -128,7 +127,7 @@ func NewNetworkingOptionsManager(globalOptions types.GlobalCommandOptions, netOp
128127
case nettype.Container:
129128
manager = &containerNetworkManager{globalOptions, netOpts, client}
130129
case nettype.CNI:
131-
manager = &cniNetworkManager{globalOptions, netOpts, nil, client}
130+
manager = &cniNetworkManager{globalOptions, netOpts, client, cniNetworkManagerPlatform{}}
132131
default:
133132
return nil, fmt.Errorf("unexpected container networking type: %q", netType)
134133
}
@@ -471,8 +470,8 @@ func (m *hostNetworkManager) ContainerNetworkingOpts(_ context.Context, containe
471470
type cniNetworkManager struct {
472471
globalOptions types.GlobalCommandOptions
473472
netOpts types.NetworkOptions
474-
netNs *netns.NetNS
475473
client *containerd.Client
474+
cniNetworkManagerPlatform
476475
}
477476

478477
// NetworkOptions Returns a copy of the internal types.NetworkOptions.

pkg/containerutil/container_network_manager_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import (
3434
"github.com/containerd/nerdctl/pkg/rootlessutil"
3535
)
3636

37+
type cniNetworkManagerPlatform struct {
38+
}
39+
3740
// Verifies that the internal network settings are correct.
3841
func (m *cniNetworkManager) VerifyNetworkOptions(_ context.Context) error {
3942
e, err := netutil.NewCNIEnv(m.globalOptions.CNIPath, m.globalOptions.CNINetConfPath, netutil.WithDefaultNetwork())

pkg/containerutil/container_network_manager_other.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ import (
2828
"github.com/containerd/nerdctl/pkg/api/types"
2929
)
3030

31+
type cniNetworkManagerPlatform struct {
32+
}
33+
3134
// Verifies that the internal network settings are correct.
3235
func (m *cniNetworkManager) VerifyNetworkOptions(_ context.Context) error {
3336
return fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)

pkg/containerutil/container_network_manager_windows.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import (
3030
"github.com/containerd/nerdctl/pkg/ocihook"
3131
)
3232

33+
type cniNetworkManagerPlatform struct {
34+
netNs *netns.NetNS
35+
}
36+
3337
// Verifies that the internal network settings are correct.
3438
func (m *cniNetworkManager) VerifyNetworkOptions(_ context.Context) error {
3539
e, err := netutil.NewCNIEnv(m.globalOptions.CNIPath, m.globalOptions.CNINetConfPath, netutil.WithDefaultNetwork())

0 commit comments

Comments
 (0)