Need to remove pods that change labels.

This commit is contained in:
Daniel Smith
2014-08-21 18:16:46 -07:00
parent 85f98a79c1
commit 72b35816cd
6 changed files with 276 additions and 157 deletions

View File

@@ -79,8 +79,15 @@ func (r *Registry) ListPods(selector labels.Selector) ([]api.Pod, error) {
}
// WatchPods begins watching for new, changed, or deleted pods.
func (r *Registry) WatchPods(resourceVersion uint64) (watch.Interface, error) {
return r.WatchList("/registry/pods", resourceVersion, tools.Everything)
func (r *Registry) WatchPods(resourceVersion uint64, filter func(*api.Pod) bool) (watch.Interface, error) {
return r.WatchList("/registry/pods", resourceVersion, func(obj interface{}) bool {
pod, ok := obj.(*api.Pod)
if !ok {
glog.Errorf("Unexpected object during pod watch: %#v", obj)
return false
}
return filter(pod)
})
}
// GetPod gets a specific pod specified by its ID.