From 2d4e72f1fab6455805c47cab97f13bfe3c348451 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Wed, 28 Jan 2015 21:07:00 -0800 Subject: [PATCH] Add some extra checking around a call to list pods. --- pkg/registry/etcd/etcd.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/registry/etcd/etcd.go b/pkg/registry/etcd/etcd.go index d372f75bea4..d2bd576cb52 100644 --- a/pkg/registry/etcd/etcd.go +++ b/pkg/registry/etcd/etcd.go @@ -347,7 +347,17 @@ func (r *Registry) WatchControllers(ctx api.Context, label, field labels.Selecto } match := label.Matches(labels.Set(controller.Labels)) if match { - pods, _ := r.ListPods(ctx, labels.Set(controller.Spec.Selector).AsSelector()) + pods, err := r.ListPods(ctx, labels.Set(controller.Spec.Selector).AsSelector()) + if err != nil { + glog.Warningf("Error listing pods: %v", err) + // No object that's useable so drop it on the floor + return false + } + if pods == nil { + glog.Warningf("Pods list is nil. This should never happen...") + // No object that's useable so drop it on the floor + return false + } controller.Status.Replicas = len(pods.Items) } return match