Skip to content

Commit

Permalink
Add control of the configuration refresh interval
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlaverse committed Dec 5, 2017
1 parent 6816630 commit 0561ea8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cmd/nginx/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
`Name of the ConfigMap that contains the custom configuration to use`)

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.`)

tcpConfigMapName = flags.String("tcp-services-configmap", "",
Expand Down Expand Up @@ -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.
If the certificate contain issues chain issues is not possible to enable OCSP.
Default is true.`)

syncRateLimit = flags.Float32("sync-rate-limit", 0.3,
`Define the sync frequency upper limit`)
)

flag.Set("logtostderr", "true")
Expand Down Expand Up @@ -210,6 +213,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
UpdateStatusOnShutdown: *updateStatusOnShutdown,
SortBackends: *sortBackends,
UseNodeInternalIP: *useNodeInternalIP,
SyncRateLimit: *syncRateLimit,
ListenPorts: &ngx_config.ListenPorts{
Default: *defServerPort,
Health: *healthzPort,
Expand Down
2 changes: 2 additions & 0 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ type Configuration struct {

FakeCertificatePath string
FakeCertificateSHA string

SyncRateLimit float32
}

// GetDefaultBackend returns the default backend
Expand Down
2 changes: 1 addition & 1 deletion internal/ingress/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func NewNGINXController(config *Configuration, fs file.Filesystem) *NGINXControl
resolver: h,
cfg: config,
sslCertTracker: store.NewSSLCertTracker(),
syncRateLimiter: flowcontrol.NewTokenBucketRateLimiter(0.3, 1),
syncRateLimiter: flowcontrol.NewTokenBucketRateLimiter(config.SyncRateLimit, 1),

recorder: eventBroadcaster.NewRecorder(scheme.Scheme, apiv1.EventSource{
Component: "nginx-ingress-controller",
Expand Down

0 comments on commit 0561ea8

Please sign in to comment.