From 93bfc4ea3afb96fadc8ef8557e5af766151b5074 Mon Sep 17 00:00:00 2001 From: kinarashah Date: Thu, 5 Apr 2018 16:38:56 -0700 Subject: [PATCH] Check for cluster name in annotations --- controller/cluster_check.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controller/cluster_check.go b/controller/cluster_check.go index 6d5f2d588..a548f96c9 100644 --- a/controller/cluster_check.go +++ b/controller/cluster_check.go @@ -30,6 +30,15 @@ func ObjectInCluster(cluster string, obj interface{}) bool { } } } + if clusterName == "" { + if a := getValue(obj, "Annotations"); a.IsValid() { + if c := a.MapIndex(reflect.ValueOf("field.cattle.io/projectId")); c.IsValid() { + if parts := strings.SplitN(c.String(), ":", 2); len(parts) == 2 { + clusterName = parts[0] + } + } + } + } return clusterName == cluster }