Add flag to allow custom ingress status update intervals (#5050)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-02-10 16:52:50 -03:00 committed by GitHub
parent 5e54f66ab2
commit 2c5819e1b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View file

@ -31,6 +31,7 @@ import (
"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
"k8s.io/ingress-nginx/internal/ingress/controller"
ngx_config "k8s.io/ingress-nginx/internal/ingress/controller/config"
"k8s.io/ingress-nginx/internal/ingress/status"
ing_net "k8s.io/ingress-nginx/internal/net"
"k8s.io/ingress-nginx/internal/nginx"
)
@ -175,6 +176,8 @@ Takes the form "<host>:port". If not provided, no admission controller is starte
streamPort = flags.Int("stream-port", 10247, "Port to use for the lua TCP/UDP endpoint configuration.")
profilerPort = flags.Int("profiler-port", 10245, "Port to use for expose the ingress controller Go profiler when it is enabled.")
statusUpdateInterval = flags.Int("status-update-interval", status.UpdateInterval, "Time interval in seconds in which the status should check if an update is required. Default is 60 seconds")
)
flags.MarkDeprecated("force-namespace-isolation", `This flag doesn't do anything.`)
@ -201,6 +204,13 @@ https://blog.maxmind.com/2019/12/18/significant-changes-to-accessing-and-using-g
return true, nil, nil
}
if *statusUpdateInterval < 5 {
klog.Warningf("The defined time to update the Ingress status too low (%v seconds). Adjusting to 5 seconds", *statusUpdateInterval)
status.UpdateInterval = 5
} else {
status.UpdateInterval = *statusUpdateInterval
}
if *ingressClass != "" {
klog.Infof("Watching for Ingress class: %s", *ingressClass)