Skip to content

Commit

Permalink
Fix event filter filtering on "or"
Browse files Browse the repository at this point in the history
The event filter used two separate filter-conditions for
"namespace" and "topic". As a result, both events matching
"topic" and events matching "namespace" were subscribed to,
causing events to be handled both by the "plugin" client, and
"container" client.

This patch rewrites the filter to match only if both namespace
and topic match.

Thanks to Stephen Day for providing the correct filter :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Dec 29, 2017
1 parent daded8d commit 295bb09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libcontainerd/client_daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,9 @@ func (c *client) processEventStream(ctx context.Context) {

eventStream, err = c.remote.EventService().Subscribe(ctx, &eventsapi.SubscribeRequest{
Filters: []string{
"namespace==" + c.namespace,
"topic~=/tasks/",
// Filter on both namespace *and* topic. To create an "and" filter,
// this must be a single, comma-separated string
"namespace==" + c.namespace + ",topic~=|^/tasks/|",
},
}, grpc.FailFast(false))
if err != nil {
Expand Down

0 comments on commit 295bb09

Please sign in to comment.