Remove some dead code in the ipvs proxy

This commit is contained in:
Dan Winship 2021-10-04 09:04:35 -04:00
parent e5976909c6
commit 508d574921
4 changed files with 3 additions and 48 deletions

View File

@ -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

View File

@ -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,
}
}

View File

@ -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{}
}

View File

@ -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
}