allocator: Fix events watch leak
allocator: Fix events watch leak

The allocator starts a watch on events and never shuts it down. If this
node loses leadership, events will continue to pile up in that queue
forever, leading to memory exhaustion.

Fix this by giving the watch a well-defined lifecycle. Return it along
with a cancel function from an init() method to make it clear it must be
cancelled, instead of sticking the cancel function value in a struct
where there is no clear responsibilty for calling it.

In the future, we might consider changing Watch to run a callback
function, so shutting down the watch is mandatory (similar to what we do
with store transactions).

Signed-off-by: Aaron Lehmann <8ecfc6017a87905413dcd7d63696a2a4c351b604@docker.com>

AliyunContainerService/swarmkit,docker/swarmkit,RenaudWasTaken/swarmkit,sungwonh/swarmkit,sungwonh/swarmkit,Noyan759/swarmkit,diogomonica/swarmkit,diogomonica/swarmkit,alyyousuf7/swarmkit,docker/swarmkit,cheyang/swarmkit,RenaudWasTaken/swarmkit,cheyang/swarmkit,Noyan759/swarmkit,jlhawn/swarmkit,jlhawn/swarmkit,dperny/swarmkit-1,AliyunContainerService/swarmkit,dperny/swarmkit-1,alyyousuf7/swarmkit