Skip to content

Commit

Permalink
Merge pull request #1651 from aledbf/remove-node-lister
Browse files Browse the repository at this point in the history
Remove node lister
  • Loading branch information
aledbf authored Nov 5, 2017
2 parents 0009eda + 3bbe249 commit 287cf12
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
8 changes: 6 additions & 2 deletions cmd/nginx/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func parseFlags() (bool, *controller.Configuration, error) {
configmaps located in a different namespace than the specified in the flag --watch-namespace.`)

disableNodeList = flags.Bool("disable-node-list", false,
`Disable querying nodes. If --force-namespace-isolation is true, this should also be set.`)
`Disable querying nodes. If --force-namespace-isolation is true, this should also be set. (DEPRECATED)`)

updateStatusOnShutdown = flags.Bool("update-status-on-shutdown", true, `Indicates if the
ingress controller should update the Ingress status IP/hostname when the controller
Expand Down Expand Up @@ -171,6 +171,11 @@ func parseFlags() (bool, *controller.Configuration, error) {
return false, nil, fmt.Errorf("Port %v is already in use. Please check the flag --ssl-passtrough-proxy-port", *sslProxyPort)
}

// TODO: remove disableNodeList flag
if *disableNodeList {
glog.Warningf("%s is DEPRECATED and will be removed in a future version.", disableNodeList)
}

config := &controller.Configuration{
APIServerHost: *apiserverHost,
KubeConfigFile: *kubeConfigFile,
Expand All @@ -189,7 +194,6 @@ func parseFlags() (bool, *controller.Configuration, error) {
DefaultHealthzURL: *defHealthzURL,
PublishService: *publishSvc,
ForceNamespaceIsolation: *forceIsolation,
DisableNodeList: *disableNodeList,
UpdateStatusOnShutdown: *updateStatusOnShutdown,
SortBackends: *sortBackends,
UseNodeInternalIP: *useNodeInternalIP,
Expand Down
1 change: 0 additions & 1 deletion pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ type Configuration struct {
Namespace string

ForceNamespaceIsolation bool
DisableNodeList bool

// optional
TCPConfigMapName string
Expand Down
16 changes: 1 addition & 15 deletions pkg/ingress/controller/listers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/tools/cache"
fcache "k8s.io/client-go/tools/cache/testing"

"k8s.io/ingress-nginx/pkg/ingress"
"k8s.io/ingress-nginx/pkg/ingress/annotations/class"
Expand All @@ -38,7 +37,6 @@ type cacheController struct {
Ingress cache.Controller
Endpoint cache.Controller
Service cache.Controller
Node cache.Controller
Secret cache.Controller
Configmap cache.Controller
}
Expand All @@ -47,7 +45,6 @@ func (c *cacheController) Run(stopCh chan struct{}) {
go c.Ingress.Run(stopCh)
go c.Endpoint.Run(stopCh)
go c.Service.Run(stopCh)
go c.Node.Run(stopCh)
go c.Secret.Run(stopCh)
go c.Configmap.Run(stopCh)

Expand All @@ -56,15 +53,14 @@ func (c *cacheController) Run(stopCh chan struct{}) {
c.Ingress.HasSynced,
c.Endpoint.HasSynced,
c.Service.HasSynced,
c.Node.HasSynced,
c.Secret.HasSynced,
c.Configmap.HasSynced,
) {
runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync"))
}
}

func (n *NGINXController) createListers(disableNodeLister bool, stopCh chan struct{}) *ingress.StoreLister {
func (n *NGINXController) createListers(stopCh chan struct{}) *ingress.StoreLister {
// from here to the end of the method all the code is just boilerplate
// required to watch Ingress, Secrets, ConfigMaps and Endoints.
// This is used to detect new content, updates or removals and act accordingly
Expand Down Expand Up @@ -223,16 +219,6 @@ func (n *NGINXController) createListers(disableNodeLister bool, stopCh chan stru
cache.NewListWatchFromClient(n.cfg.Client.CoreV1().RESTClient(), "services", n.cfg.Namespace, fields.Everything()),
&apiv1.Service{}, n.cfg.ResyncPeriod, cache.ResourceEventHandlerFuncs{})

var nodeListerWatcher cache.ListerWatcher
if disableNodeLister {
nodeListerWatcher = fcache.NewFakeControllerSource()
} else {
nodeListerWatcher = cache.NewListWatchFromClient(n.cfg.Client.CoreV1().RESTClient(), "nodes", apiv1.NamespaceAll, fields.Everything())
}
lister.Node.Store, controller.Node = cache.NewInformer(
nodeListerWatcher,
&apiv1.Node{}, n.cfg.ResyncPeriod, cache.ResourceEventHandlerFuncs{})

controller.Run(n.stopCh)

return lister
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingress/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewNGINXController(config *Configuration) *NGINXController {

n.syncQueue = task.NewTaskQueue(n.syncIngress)

n.listers = n.createListers(config.DisableNodeList, n.stopCh)
n.listers = n.createListers(n.stopCh)

if config.UpdateStatus {
n.syncStatus = status.NewStatusSyncer(status.Config{
Expand Down
1 change: 0 additions & 1 deletion pkg/ingress/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var (
type StoreLister struct {
Ingress store.IngressLister
Service store.ServiceLister
Node store.NodeLister
Endpoint store.EndpointLister
Secret store.SecretLister
ConfigMap store.ConfigMapLister
Expand Down

0 comments on commit 287cf12

Please sign in to comment.