Skip to content

Commit

Permalink
Check for cluster name in annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kinarashah authored and ibuildthecloud committed Apr 6, 2018
1 parent 4d46cba commit 93bfc4e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controller/cluster_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 93bfc4e

Please sign in to comment.