Add simple batching to endpoints controller

This commit is contained in:
Maciej Borsz
2019-07-24 11:01:42 +02:00
parent 3ea28073a4
commit 2fae3cbcfe
8 changed files with 479 additions and 61 deletions

View File

@@ -300,6 +300,7 @@ func startEndpointController(ctx ControllerContext) (http.Handler, bool, error)
ctx.InformerFactory.Core().V1().Services(),
ctx.InformerFactory.Core().V1().Endpoints(),
ctx.ClientBuilder.ClientOrDie("endpoint-controller"),
ctx.ComponentConfig.EndpointController.EndpointUpdatesBatchPeriod.Duration,
).Run(int(ctx.ComponentConfig.EndpointController.ConcurrentEndpointSyncs), ctx.Stop)
return nil, true, nil
}

View File

@@ -34,6 +34,7 @@ func (o *EndpointControllerOptions) AddFlags(fs *pflag.FlagSet) {
}
fs.Int32Var(&o.ConcurrentEndpointSyncs, "concurrent-endpoint-syncs", o.ConcurrentEndpointSyncs, "The number of endpoint syncing operations that will be done concurrently. Larger number = faster endpoint updating, but more CPU (and network) load")
fs.DurationVar(&o.EndpointUpdatesBatchPeriod.Duration, "endpoint-updates-batch-period", o.EndpointUpdatesBatchPeriod.Duration, "The length of endpoint 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 EndPointController config with options.
@@ -43,6 +44,7 @@ func (o *EndpointControllerOptions) ApplyTo(cfg *endpointconfig.EndpointControll
}
cfg.ConcurrentEndpointSyncs = o.ConcurrentEndpointSyncs
cfg.EndpointUpdatesBatchPeriod = o.EndpointUpdatesBatchPeriod
return nil
}