From c842cc5247c66630c88c7dc8235862a1146c595e Mon Sep 17 00:00:00 2001 From: jornshen Date: Thu, 8 Apr 2021 16:08:54 +0800 Subject: [PATCH] no watch endpointslice in userpace mode --- cmd/kube-proxy/app/server_others.go | 8 +++++++- cmd/kube-proxy/app/server_windows.go | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmd/kube-proxy/app/server_others.go b/cmd/kube-proxy/app/server_others.go index 62547325b34..011ff019f48 100644 --- a/cmd/kube-proxy/app/server_others.go +++ b/cmd/kube-proxy/app/server_others.go @@ -364,6 +364,12 @@ func newProxyServer( } } + useEndpointSlices := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) + if proxyMode == proxyModeUserspace { + // userspace mode doesn't support endpointslice. + useEndpointSlices = false + } + return &ProxyServer{ Client: client, EventClient: eventClient, @@ -384,7 +390,7 @@ func newProxyServer( OOMScoreAdj: config.OOMScoreAdj, ConfigSyncPeriod: config.ConfigSyncPeriod.Duration, HealthzServer: healthzServer, - UseEndpointSlices: utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying), + UseEndpointSlices: useEndpointSlices, }, nil } diff --git a/cmd/kube-proxy/app/server_windows.go b/cmd/kube-proxy/app/server_windows.go index 12c714a3934..2a625c53213 100644 --- a/cmd/kube-proxy/app/server_windows.go +++ b/cmd/kube-proxy/app/server_windows.go @@ -160,7 +160,11 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi return nil, fmt.Errorf("unable to create proxier: %v", err) } } - + useEndpointSlices := utilfeature.DefaultFeatureGate.Enabled(features.WindowsEndpointSliceProxying) + if proxyMode == proxyModeUserspace { + // userspace mode doesn't support endpointslice. + useEndpointSlices = false + } return &ProxyServer{ Client: client, EventClient: eventClient, @@ -175,7 +179,7 @@ func newProxyServer(config *proxyconfigapi.KubeProxyConfiguration, cleanupAndExi OOMScoreAdj: config.OOMScoreAdj, ConfigSyncPeriod: config.ConfigSyncPeriod.Duration, HealthzServer: healthzServer, - UseEndpointSlices: utilfeature.DefaultFeatureGate.Enabled(features.WindowsEndpointSliceProxying), + UseEndpointSlices: useEndpointSlices, }, nil }