From 192e186119ce1bbead4e0233b2de2192076b86c5 Mon Sep 17 00:00:00 2001 From: derekwaynecarr Date: Thu, 12 Feb 2015 17:14:16 -0500 Subject: [PATCH] If an object has no namespace, do not add a leading slash --- pkg/client/cache/store.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/client/cache/store.go b/pkg/client/cache/store.go index ab4a3a07920..828a1224ba3 100644 --- a/pkg/client/cache/store.go +++ b/pkg/client/cache/store.go @@ -57,7 +57,10 @@ func MetaNamespaceKeyFunc(obj interface{}) (string, error) { if err != nil { return "", fmt.Errorf("object has no meta: %v", err) } - return meta.Namespace() + "/" + meta.Name(), nil + if len(meta.Namespace()) > 0 { + return meta.Namespace() + "/" + meta.Name(), nil + } + return meta.Name(), nil } type cache struct {