Creating new EndpointSliceProxying feature gate for kube-proxy
This creates a new EndpointSliceProxying feature gate to cover EndpointSlice consumption (kube-proxy) and allow the existing EndpointSlice feature gate to focus on EndpointSlice production only. Along with that addition, this enables the EndpointSlice feature gate by default, now only affecting the controller. The rationale here is that it's really difficult to guarantee all EndpointSlices are created in a cluster upgrade process before kube-proxy attempts to consume them. Although masters are generally upgraded before nodes, and in most cases, the controller would have enough time to create EndpointSlices before a new node with kube-proxy spun up, there are plenty of edge cases where that might not be the case. The primary limitation on EndpointSlice creation is the API rate limit of 20QPS. In clusters with a lot of endpoints and/or with a lot of other API requests, it could be difficult to create all the EndpointSlices before a new node with kube-proxy targeting EndpointSlices spun up. Separating this into 2 feature gates allows for a more gradual rollout with the EndpointSlice controller being enabled by default in 1.18, and EndpointSlices for kube-proxy being enabled by default in the next release.
This commit is contained in:
parent
acf64f4501
commit
47b2593d59
@ -313,7 +313,7 @@ func newProxyServer(
|
|||||||
OOMScoreAdj: config.OOMScoreAdj,
|
OOMScoreAdj: config.OOMScoreAdj,
|
||||||
ConfigSyncPeriod: config.ConfigSyncPeriod.Duration,
|
ConfigSyncPeriod: config.ConfigSyncPeriod.Duration,
|
||||||
HealthzServer: healthzServer,
|
HealthzServer: healthzServer,
|
||||||
UseEndpointSlices: utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice),
|
UseEndpointSlices: utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +487,12 @@ const (
|
|||||||
// Enable Endpoint Slices for more scalable Service endpoints.
|
// Enable Endpoint Slices for more scalable Service endpoints.
|
||||||
EndpointSlice featuregate.Feature = "EndpointSlice"
|
EndpointSlice featuregate.Feature = "EndpointSlice"
|
||||||
|
|
||||||
|
// owner: @robscott @freehan
|
||||||
|
// alpha: v1.18
|
||||||
|
//
|
||||||
|
// Enable Endpoint Slice consumption by kube-proxy for improved scalability.
|
||||||
|
EndpointSliceProxying featuregate.Feature = "EndpointSliceProxying"
|
||||||
|
|
||||||
// owner: @Huang-Wei
|
// owner: @Huang-Wei
|
||||||
// alpha: v1.16
|
// alpha: v1.16
|
||||||
//
|
//
|
||||||
@ -595,6 +601,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
PodOverhead: {Default: false, PreRelease: featuregate.Alpha},
|
PodOverhead: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
IPv6DualStack: {Default: false, PreRelease: featuregate.Alpha},
|
IPv6DualStack: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
EndpointSlice: {Default: false, PreRelease: featuregate.Beta},
|
EndpointSlice: {Default: false, PreRelease: featuregate.Beta},
|
||||||
|
EndpointSliceProxying: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
EvenPodsSpread: {Default: false, PreRelease: featuregate.Alpha},
|
EvenPodsSpread: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
StartupProbe: {Default: true, PreRelease: featuregate.Beta},
|
StartupProbe: {Default: true, PreRelease: featuregate.Beta},
|
||||||
AllowInsecureBackendProxy: {Default: true, PreRelease: featuregate.Beta},
|
AllowInsecureBackendProxy: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
@ -291,7 +291,7 @@ func NewProxier(ipt utiliptables.Interface,
|
|||||||
return nil, fmt.Errorf("clusterCIDR %s has incorrect IP version: expect isIPv6=%t", clusterCIDR, ipt.IsIpv6())
|
return nil, fmt.Errorf("clusterCIDR %s has incorrect IP version: expect isIPv6=%t", clusterCIDR, ipt.IsIpv6())
|
||||||
}
|
}
|
||||||
|
|
||||||
endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice)
|
endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying)
|
||||||
|
|
||||||
serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder)
|
serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder)
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ func (proxier *Proxier) OnServiceDelete(service *v1.Service) {
|
|||||||
func (proxier *Proxier) OnServiceSynced() {
|
func (proxier *Proxier) OnServiceSynced() {
|
||||||
proxier.mu.Lock()
|
proxier.mu.Lock()
|
||||||
proxier.servicesSynced = true
|
proxier.servicesSynced = true
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) {
|
||||||
proxier.setInitialized(proxier.endpointSlicesSynced)
|
proxier.setInitialized(proxier.endpointSlicesSynced)
|
||||||
} else {
|
} else {
|
||||||
proxier.setInitialized(proxier.endpointsSynced)
|
proxier.setInitialized(proxier.endpointsSynced)
|
||||||
@ -965,7 +965,7 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
// 2. ServiceTopology is not enabled.
|
// 2. ServiceTopology is not enabled.
|
||||||
// 3. EndpointSlice is not enabled (service topology depends on endpoint slice
|
// 3. EndpointSlice is not enabled (service topology depends on endpoint slice
|
||||||
// to get topology information).
|
// to get topology information).
|
||||||
if !svcInfo.OnlyNodeLocalEndpoints() && utilfeature.DefaultFeatureGate.Enabled(features.ServiceTopology) && utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) {
|
if !svcInfo.OnlyNodeLocalEndpoints() && utilfeature.DefaultFeatureGate.Enabled(features.ServiceTopology) && utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) {
|
||||||
allEndpoints = proxy.FilterTopologyEndpoint(proxier.nodeLabels, svcInfo.TopologyKeys(), allEndpoints)
|
allEndpoints = proxy.FilterTopologyEndpoint(proxier.nodeLabels, svcInfo.TopologyKeys(), allEndpoints)
|
||||||
hasEndpoints = len(allEndpoints) > 0
|
hasEndpoints = len(allEndpoints) > 0
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,7 @@ func NewProxier(ipt utiliptables.Interface,
|
|||||||
|
|
||||||
serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder)
|
serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder)
|
||||||
|
|
||||||
endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice)
|
endpointSlicesEnabled := utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying)
|
||||||
|
|
||||||
proxier := &Proxier{
|
proxier := &Proxier{
|
||||||
portsMap: make(map[utilproxy.LocalPort]utilproxy.Closeable),
|
portsMap: make(map[utilproxy.LocalPort]utilproxy.Closeable),
|
||||||
@ -855,7 +855,7 @@ func (proxier *Proxier) OnServiceDelete(service *v1.Service) {
|
|||||||
func (proxier *Proxier) OnServiceSynced() {
|
func (proxier *Proxier) OnServiceSynced() {
|
||||||
proxier.mu.Lock()
|
proxier.mu.Lock()
|
||||||
proxier.servicesSynced = true
|
proxier.servicesSynced = true
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) {
|
||||||
proxier.setInitialized(proxier.endpointSlicesSynced)
|
proxier.setInitialized(proxier.endpointSlicesSynced)
|
||||||
} else {
|
} else {
|
||||||
proxier.setInitialized(proxier.endpointsSynced)
|
proxier.setInitialized(proxier.endpointsSynced)
|
||||||
@ -1963,7 +1963,7 @@ func (proxier *Proxier) syncEndpoint(svcPortName proxy.ServicePortName, onlyNode
|
|||||||
// 2. ServiceTopology is not enabled.
|
// 2. ServiceTopology is not enabled.
|
||||||
// 3. EndpointSlice is not enabled (service topology depends on endpoint slice
|
// 3. EndpointSlice is not enabled (service topology depends on endpoint slice
|
||||||
// to get topology information).
|
// to get topology information).
|
||||||
if !onlyNodeLocalEndpoints && utilfeature.DefaultFeatureGate.Enabled(features.ServiceTopology) && utilfeature.DefaultFeatureGate.Enabled(features.EndpointSlice) {
|
if !onlyNodeLocalEndpoints && utilfeature.DefaultFeatureGate.Enabled(features.ServiceTopology) && utilfeature.DefaultFeatureGate.Enabled(features.EndpointSliceProxying) {
|
||||||
endpoints = proxy.FilterTopologyEndpoint(proxier.nodeLabels, proxier.serviceMap[svcPortName].TopologyKeys(), endpoints)
|
endpoints = proxy.FilterTopologyEndpoint(proxier.nodeLabels, proxier.serviceMap[svcPortName].TopologyKeys(), endpoints)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user