Skip to content

Commit

Permalink
Allow watching of resources in all namespaces at once (#334)
Browse files Browse the repository at this point in the history
The `namespace` field of a resource event source is now optional to
allow for configuration that would watch for resource related events in
all namespaces at once. Simply omitting the field works in this way
because the k8s dynamic client used in implementation can accept a
zero-length string for namespace.
  • Loading branch information
marxarelli authored and VaibhavPage committed Aug 15, 2019
1 parent e573cd4 commit 01c2bff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 11 additions & 0 deletions examples/event-sources/resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,14 @@ data:
labels:
workflows.argoproj.io/completed: "true"
prefix: "hello"
# watch for completed workflows in any namespace
example-without-namespace: |-
# namespace: (omitted to match any namespace)
group: "k8s.io"
version: v1
kind: Workflow
type: ADDED
filter:
labels:
workflows.argoproj.io/completed: "true"
3 changes: 0 additions & 3 deletions gateways/core/resource/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ func validateResource(config interface{}) error {
if res.Version == "" {
return fmt.Errorf("resource version must be specified")
}
if res.Namespace == "" {
return fmt.Errorf("resource namespace must be specified")
}
if res.Kind == "" {
return fmt.Errorf("resource kind must be specified")
}
Expand Down

0 comments on commit 01c2bff

Please sign in to comment.