Implement simple endpoint slice batching

This commit is contained in:
Maciej Borsz
2020-03-02 21:00:06 +01:00
parent b6b494b448
commit 49b11b5431
11 changed files with 426 additions and 10 deletions

View File

@@ -48,6 +48,7 @@ func startEndpointSliceController(ctx ControllerContext) (http.Handler, bool, er
ctx.InformerFactory.Discovery().V1beta1().EndpointSlices(),
ctx.ComponentConfig.EndpointSliceController.MaxEndpointsPerSlice,
ctx.ClientBuilder.ClientOrDie("endpointslice-controller"),
ctx.ComponentConfig.EndpointSliceController.EndpointUpdatesBatchPeriod.Duration,
).Run(int(ctx.ComponentConfig.EndpointSliceController.ConcurrentServiceEndpointSyncs), ctx.Stop)
return nil, true, nil
}

View File

@@ -18,6 +18,7 @@ package options
import (
"fmt"
"github.com/spf13/pflag"
endpointsliceconfig "k8s.io/kubernetes/pkg/controller/endpointslice/config"
@@ -43,6 +44,7 @@ func (o *EndpointSliceControllerOptions) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&o.ConcurrentServiceEndpointSyncs, "concurrent-service-endpoint-syncs", o.ConcurrentServiceEndpointSyncs, "The number of service endpoint syncing operations that will be done concurrently. Larger number = faster endpoint slice updating, but more CPU (and network) load. Defaults to 5.")
fs.Int32Var(&o.MaxEndpointsPerSlice, "max-endpoints-per-slice", o.MaxEndpointsPerSlice, "The maximum number of endpoints that will be added to an EndpointSlice. More endpoints per slice will result in less endpoint slices, but larger resources. Defaults to 100.")
fs.DurationVar(&o.EndpointUpdatesBatchPeriod.Duration, "endpointslice-updates-batch-period", o.EndpointUpdatesBatchPeriod.Duration, "The length of endpoint slice updates batching period. Processing of pod changes will be delayed by this duration to join them with potential upcoming updates and reduce the overall number of endpoints updates. Larger number = higher endpoint programming latency, but lower number of endpoints revision generated")
}
// ApplyTo fills up EndpointSliceController config with options.
@@ -53,6 +55,7 @@ func (o *EndpointSliceControllerOptions) ApplyTo(cfg *endpointsliceconfig.Endpoi
cfg.ConcurrentServiceEndpointSyncs = o.ConcurrentServiceEndpointSyncs
cfg.MaxEndpointsPerSlice = o.MaxEndpointsPerSlice
cfg.EndpointUpdatesBatchPeriod = o.EndpointUpdatesBatchPeriod
return nil
}