Add namespace flag for machine healthcheck
@@ -4,6 +4,8 @@ import (
"flag"
"runtime"
+ "k8s.io/klog"
+
"github.com/golang/glog"
mapiv1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
"github.com/openshift/machine-api-operator/pkg/apis/healthchecking/v1alpha1"
@@ -22,6 +24,7 @@ func printVersion() {
}
func main() {
+ watchNamespace := flag.String("namespace", "", "Namespace that the controller watches to reconcile machine-api objects. If unspecified, the controller watches for machine-api objects across all namespaces.")
flag.Parse()
printVersion()
@@ -31,8 +34,13 @@ func main() {
glog.Fatal(err)
}
+ opts := manager.Options{}
+ if *watchNamespace != "" {
+ opts.Namespace = *watchNamespace
+ klog.Infof("Watching machine-api objects only in namespace %q for reconciliation.", opts.Namespace)
+ }
// Create a new Cmd to provide shared dependencies and start components
- mgr, err := manager.New(cfg, manager.Options{})
+ mgr, err := manager.New(cfg, opts)
if err != nil {
glog.Fatal(err)
}
