From 9e0c9b4f5a982b370924e5ecd56892db6f906ebf Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Tue, 23 Jun 2015 12:20:59 +0200 Subject: [PATCH] Mesos: create static pod file source only for configured static pods The file source was created even when no static pods were configured. In this case it was never marked as seen. As a consequence the kubelet syncPods functions never deleted pods because it was too cautious due an unseen pod source, leading to leaked pods. --- contrib/mesos/pkg/executor/service/service.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/mesos/pkg/executor/service/service.go b/contrib/mesos/pkg/executor/service/service.go index dd3b6605b9e..a3b41659eef 100644 --- a/contrib/mesos/pkg/executor/service/service.go +++ b/contrib/mesos/pkg/executor/service/service.go @@ -387,8 +387,10 @@ func (ks *KubeletExecutorServer) createAndInitKubelet( StaticPodsConfigPath: staticPodsConfigPath, }) - fileSourceUpdates := pc.Channel(kubelet.FileSource) go exec.InitializeStaticPodsSource(func() { + // Create file source only when we are called back. Otherwise, it is never marked unseen. + fileSourceUpdates := pc.Channel(kubelet.FileSource) + kconfig.NewSourceFile(staticPodsConfigPath, kc.Hostname, kc.FileCheckFrequency, fileSourceUpdates) })