1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-16 07:09:44 +00:00

Check for cluster name in annotations

This commit is contained in:
kinarashah
2018-04-05 16:38:56 -07:00
committed by Darren Shepherd
parent 4d46cbab5b
commit 93bfc4ea3a

View File

@@ -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
}