Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to allow switch off the update of Ingress status #149

Merged
merged 1 commit into from
Jan 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -257,11 +259,15 @@ 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,
})
} else {
glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)")
}

ic.annotations = newAnnotationExtractor(ic)

Expand Down Expand Up @@ -970,7 +976,9 @@ func (ic GenericController) Stop() error {
close(ic.stopCh)
go ic.syncQueue.Shutdown()
go ic.secretQueue.Shutdown()
ic.syncStatus.Shutdown()
if ic.syncStatus != nil {
ic.syncStatus.Shutdown()
}
return nil
}

Expand All @@ -990,7 +998,9 @@ func (ic GenericController) Start() {
go ic.secretQueue.Run(5*time.Second, ic.stopCh)
go ic.syncQueue.Run(5*time.Second, ic.stopCh)

go ic.syncStatus.Run(ic.stopCh)
if ic.syncStatus != nil {
go ic.syncStatus.Run(ic.stopCh)
}

<-ic.stopCh
}
4 changes: 4 additions & 0 deletions core/pkg/ingress/controller/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down