kube-proxy: use API constants for proxy modes rather than local redefinitions

This commit is contained in:
Dan Winship
2022-08-16 09:23:20 -04:00
parent 1609017f2b
commit 946ce55b04
3 changed files with 19 additions and 26 deletions

View File

@@ -86,13 +86,6 @@ import (
utilpointer "k8s.io/utils/pointer"
)
const (
proxyModeUserspace = "userspace"
proxyModeIPTables = "iptables"
proxyModeIPVS = "ipvs"
proxyModeKernelspace = "kernelspace" //nolint:deadcode,varcheck
)
// proxyRun defines the interface to run a specified ProxyServer
type proxyRun interface {
Run() error
@@ -540,7 +533,7 @@ type ProxyServer struct {
Recorder events.EventRecorder
ConntrackConfiguration kubeproxyconfig.KubeProxyConntrackConfiguration
Conntracker Conntracker // if nil, ignored
ProxyMode string
ProxyMode kubeproxyconfig.ProxyMode
NodeRef *v1.ObjectReference
MetricsBindAddress string
BindAddressHardFail bool
@@ -611,7 +604,7 @@ func serveHealthz(hz healthcheck.ProxierHealthUpdater, errCh chan error) {
go wait.Until(fn, 5*time.Second, wait.NeverStop)
}
func serveMetrics(bindAddress, proxyMode string, enableProfiling bool, errCh chan error) {
func serveMetrics(bindAddress string, proxyMode kubeproxyconfig.ProxyMode, enableProfiling bool, errCh chan error) {
if len(bindAddress) == 0 {
return
}