Add control of the configuration refresh interval

This commit is contained in:
Max Laverse 2017-12-05 20:07:34 +01:00
parent 681663045e
commit 0561ea8b87
3 changed files with 8 additions and 2 deletions

View file

@ -56,7 +56,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
`Name of the ConfigMap that contains the custom configuration to use`) `Name of the ConfigMap that contains the custom configuration to use`)
publishSvc = flags.String("publish-service", "", publishSvc = flags.String("publish-service", "",
`Service fronting the ingress controllers. Takes the form namespace/name. `Service fronting the ingress controllers. Takes the form namespace/name.
The controller will set the endpoint records on the ingress objects to reflect those on the service.`) The controller will set the endpoint records on the ingress objects to reflect those on the service.`)
tcpConfigMapName = flags.String("tcp-services-configmap", "", tcpConfigMapName = flags.String("tcp-services-configmap", "",
@ -127,6 +127,9 @@ func parseFlags() (bool, *controller.Configuration, error) {
`Defines if the nginx ingress controller should check the secrets for missing intermediate CA certificates. `Defines if the nginx ingress controller should check the secrets for missing intermediate CA certificates.
If the certificate contain issues chain issues is not possible to enable OCSP. If the certificate contain issues chain issues is not possible to enable OCSP.
Default is true.`) Default is true.`)
syncRateLimit = flags.Float32("sync-rate-limit", 0.3,
`Define the sync frequency upper limit`)
) )
flag.Set("logtostderr", "true") flag.Set("logtostderr", "true")
@ -210,6 +213,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
UpdateStatusOnShutdown: *updateStatusOnShutdown, UpdateStatusOnShutdown: *updateStatusOnShutdown,
SortBackends: *sortBackends, SortBackends: *sortBackends,
UseNodeInternalIP: *useNodeInternalIP, UseNodeInternalIP: *useNodeInternalIP,
SyncRateLimit: *syncRateLimit,
ListenPorts: &ngx_config.ListenPorts{ ListenPorts: &ngx_config.ListenPorts{
Default: *defServerPort, Default: *defServerPort,
Health: *healthzPort, Health: *healthzPort,

View file

@ -107,6 +107,8 @@ type Configuration struct {
FakeCertificatePath string FakeCertificatePath string
FakeCertificateSHA string FakeCertificateSHA string
SyncRateLimit float32
} }
// GetDefaultBackend returns the default backend // GetDefaultBackend returns the default backend

View file

@ -106,7 +106,7 @@ func NewNGINXController(config *Configuration, fs file.Filesystem) *NGINXControl
resolver: h, resolver: h,
cfg: config, cfg: config,
sslCertTracker: store.NewSSLCertTracker(), sslCertTracker: store.NewSSLCertTracker(),
syncRateLimiter: flowcontrol.NewTokenBucketRateLimiter(0.3, 1), syncRateLimiter: flowcontrol.NewTokenBucketRateLimiter(config.SyncRateLimit, 1),
recorder: eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{ recorder: eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{
Component: "nginx-ingress-controller", Component: "nginx-ingress-controller",