Skip to content

Commit

Permalink
Added support to specify a namespace to watch for Ingress resources
Browse files Browse the repository at this point in the history
  • Loading branch information
pleshakov committed Mar 31, 2016
1 parent 66cc6d5 commit 45ed5b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion nginx-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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() {
Expand All @@ -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()
}

Expand Down
7 changes: 6 additions & 1 deletion nginx-plus-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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() {
Expand All @@ -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()
}

Expand Down

0 comments on commit 45ed5b9

Please sign in to comment.