Add flag to allow switch off the update of Ingress status

This commit is contained in:
Manuel de Brito Fontes 2017-01-20 19:01:37 -03:00
parent 7553ab361a
commit 34c42f2869
2 changed files with 13 additions and 5 deletions

View file

@ -128,6 +128,8 @@ type Configuration struct {
// Backend is the particular implementation to be used.
// (for instance NGINX)
Backend ingress.Controller
UpdateStatus bool
}
// newIngressController creates an Ingress controller
@ -257,11 +259,13 @@ func newIngressController(config *Configuration) *GenericController {
cache.ResourceEventHandlerFuncs{},
cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc})
ic.syncStatus = status.NewStatusSyncer(status.Config{
Client: config.Client,
PublishService: ic.cfg.PublishService,
IngressLister: ic.ingLister,
})
if !config.UpdateStatus {
ic.syncStatus = status.NewStatusSyncer(status.Config{
Client: config.Client,
PublishService: ic.cfg.PublishService,
IngressLister: ic.ingLister,
})
}
ic.annotations = newAnnotationExtractor(ic)

View file

@ -73,6 +73,9 @@ func NewIngressController(backend ingress.Controller) *GenericController {
defHealthzURL = flags.String("health-check-path", "/healthz", `Defines
the URL to be used as health check inside in the default server in NGINX.`)
updateStatus = flags.Bool("update-status", true, `Indicates if the
ingress controller should update the Ingress status IP/hostname. Default is true`)
)
flags.AddGoFlagSet(flag.CommandLine)
@ -134,6 +137,7 @@ func NewIngressController(backend ingress.Controller) *GenericController {
os.MkdirAll(ingress.DefaultSSLDirectory, 0655)
config := &Configuration{
UpdateStatus: *updateStatus,
Client: kubeClient,
ResyncPeriod: *resyncPeriod,
DefaultService: *defaultSvc,