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:
committed by
Darren Shepherd
parent
4d46cbab5b
commit
93bfc4ea3a
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user