From 295bb09184fe473933498bb0efb59b8acb124f55 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 29 Dec 2017 02:47:56 +0100 Subject: [PATCH] Fix event filter filtering on "or" 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 --- libcontainerd/client_daemon.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcontainerd/client_daemon.go b/libcontainerd/client_daemon.go index a9f7c11dd1..7508968fd5 100644 --- a/libcontainerd/client_daemon.go +++ b/libcontainerd/client_daemon.go @@ -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 {