diff --git a/cmd/kube-proxy/app/server_others.go b/cmd/kube-proxy/app/server_others.go index 5f02daa3ae9..b0537c504bd 100644 --- a/cmd/kube-proxy/app/server_others.go +++ b/cmd/kube-proxy/app/server_others.go @@ -108,7 +108,7 @@ func newProxyServer( } if canUseIPVS { - ipvsInterface = utilipvs.New(execer) + ipvsInterface = utilipvs.New() } // We omit creation of pretty much everything if we run in cleanup mode diff --git a/pkg/util/ipvs/ipvs_linux.go b/pkg/util/ipvs/ipvs_linux.go index 914d2d9afbe..14a7184f09c 100644 --- a/pkg/util/ipvs/ipvs_linux.go +++ b/pkg/util/ipvs/ipvs_linux.go @@ -31,12 +31,10 @@ import ( libipvs "github.com/moby/ipvs" "k8s.io/klog/v2" - utilexec "k8s.io/utils/exec" ) // runner implements ipvs.Interface. type runner struct { - exec utilexec.Interface ipvsHandle *libipvs.Handle mu sync.Mutex // Protect Netlink calls } @@ -45,14 +43,13 @@ type runner struct { type Protocol uint16 // New returns a new Interface which will call ipvs APIs. -func New(exec utilexec.Interface) Interface { +func New() Interface { handle, err := libipvs.New("") if err != nil { klog.Errorf("IPVS interface can't be initialized, error: %v", err) return nil } return &runner{ - exec: exec, ipvsHandle: handle, } } diff --git a/pkg/util/ipvs/ipvs_unsupported.go b/pkg/util/ipvs/ipvs_unsupported.go index 3fc846baefc..74d821561d9 100644 --- a/pkg/util/ipvs/ipvs_unsupported.go +++ b/pkg/util/ipvs/ipvs_unsupported.go @@ -22,12 +22,10 @@ package ipvs import ( "fmt" "time" - - utilexec "k8s.io/utils/exec" ) // New returns a dummy Interface for unsupported platform. -func New(utilexec.Interface) Interface { +func New() Interface { return &runner{} } diff --git a/pkg/util/ipvs/kernelcheck_unsupported.go b/pkg/util/ipvs/kernelcheck_unsupported.go deleted file mode 100644 index 7f1657465c7..00000000000 --- a/pkg/util/ipvs/kernelcheck_unsupported.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build !linux -// +build !linux - -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package ipvs - -import ( - utilsexec "k8s.io/utils/exec" -) - -// RequiredIPVSKernelModulesAvailableCheck tests IPVS required kernel modules. -type RequiredIPVSKernelModulesAvailableCheck struct { - Executor utilsexec.Interface -} - -// Name returns label for RequiredIPVSKernelModulesAvailableCheck -func (r RequiredIPVSKernelModulesAvailableCheck) Name() string { - return "RequiredIPVSKernelModulesAvailable" -} - -// Check try to validates IPVS required kernel modules exists or not. -func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []error) { - - return nil, nil -}