Skip to content

Commit

Permalink
Allow controller to watch a specified namespace
Browse files Browse the repository at this point in the history
Add a command line option to optionally watch a specific namespace. The
default is to watch all namespaces.
  • Loading branch information
fraenkel authored and tekton-robot committed Mar 3, 2020
1 parent 6ff5e84 commit caaae67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import (
"github.com/tektoncd/pipeline/pkg/apis/pipeline"
"github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun"
"github.com/tektoncd/pipeline/pkg/reconciler/taskrun"
corev1 "k8s.io/api/core/v1"
"knative.dev/pkg/injection"
"knative.dev/pkg/injection/sharedmain"
"knative.dev/pkg/signals"
)

const (
Expand All @@ -49,6 +52,7 @@ var (
"The container image containing our PR binary.")
imageDigestExporterImage = flag.String("imagedigest-exporter-image", "override-with-imagedigest-exporter-image:latest",
"The container image containing our image digest exporter binary.")
namespace = flag.String("namespace", corev1.NamespaceAll, "Namespace to restrict informer to. Optional, defaults to all namespaces.")
)

func main() {
Expand All @@ -65,7 +69,7 @@ func main() {
PRImage: *prImage,
ImageDigestExporterImage: *imageDigestExporterImage,
}
sharedmain.Main(ControllerLogKey,
sharedmain.MainWithContext(injection.WithNamespaceScope(signals.NewContext(), *namespace), ControllerLogKey,
taskrun.NewController(images),
pipelinerun.NewController(images),
)
Expand Down

0 comments on commit caaae67

Please sign in to comment.