diff --git a/nginx-controller/main.go b/nginx-controller/main.go index 7bd86547b2..7abdbc1462 100644 --- a/nginx-controller/main.go +++ b/nginx-controller/main.go @@ -8,6 +8,7 @@ import ( "github.com/nginxinc/kubernetes-ingress/nginx-controller/controller" "github.com/nginxinc/kubernetes-ingress/nginx-controller/nginx" + "k8s.io/kubernetes/pkg/api" client "k8s.io/kubernetes/pkg/client/unversioned" ) @@ -17,6 +18,10 @@ var ( given url and creates a proxy client. Regenerated NGINX configuration files are not written to the disk, instead they are printed to stdout. Also NGINX is not getting invoked. This flag is for testing.`) + + watchNamespace = flag.String("watch-namespace", api.NamespaceAll, + `Namespace to watch for Ingress/Services/Endpoints. By default the controller + watches acrosss all namespaces`) ) func main() { @@ -41,7 +46,7 @@ func main() { resolver := getKubeDNSIP(kubeClient) ngxc, _ := nginx.NewNGINXController(resolver, "/etc/nginx/", local) ngxc.Start() - lbc, _ := controller.NewLoadBalancerController(kubeClient, 30*time.Second, "default", ngxc) + lbc, _ := controller.NewLoadBalancerController(kubeClient, 30*time.Second, *watchNamespace, ngxc) lbc.Run() } diff --git a/nginx-plus-controller/main.go b/nginx-plus-controller/main.go index 003f5347b8..1496170a0a 100644 --- a/nginx-plus-controller/main.go +++ b/nginx-plus-controller/main.go @@ -8,6 +8,7 @@ import ( "github.com/nginxinc/kubernetes-ingress/nginx-plus-controller/controller" "github.com/nginxinc/kubernetes-ingress/nginx-plus-controller/nginx" + "k8s.io/kubernetes/pkg/api" client "k8s.io/kubernetes/pkg/client/unversioned" ) @@ -17,6 +18,10 @@ var ( given url and creates a proxy client. Regenerated NGINX configuration files are not written to the disk, instead they are printed to stdout. Also NGINX is not getting invoked. This flag is for testing.`) + + watchNamespace = flag.String("watch-namespace", api.NamespaceAll, + `Namespace to watch for Ingress/Services/Endpoints. By default the controller + watches acrosss all namespaces`) ) func main() { @@ -41,7 +46,7 @@ func main() { resolver := getKubeDNSIP(kubeClient) ngxc, _ := nginx.NewNGINXController(resolver, "/etc/nginx/", local) ngxc.Start() - lbc, _ := controller.NewLoadBalancerController(kubeClient, 30*time.Second, "default", ngxc) + lbc, _ := controller.NewLoadBalancerController(kubeClient, 30*time.Second, *watchNamespace, ngxc) lbc.Run() }