IsOwnedByCluster checks that an object is owned by a Cluster and returns the owner name
(obj client.Object)
| 1495 | // IsOwnedByCluster checks that an object is owned by a Cluster and returns |
| 1496 | // the owner name |
| 1497 | func IsOwnedByCluster(obj client.Object) (string, bool) { |
| 1498 | owner := metav1.GetControllerOf(obj) |
| 1499 | if owner == nil { |
| 1500 | return "", false |
| 1501 | } |
| 1502 | |
| 1503 | if owner.Kind != apiv1.ClusterKind { |
| 1504 | return "", false |
| 1505 | } |
| 1506 | |
| 1507 | if owner.APIVersion != apiSGVString { |
| 1508 | return "", false |
| 1509 | } |
| 1510 | |
| 1511 | return owner.Name, true |
| 1512 | } |
| 1513 | |
| 1514 | // mapSecretsToClusters returns a function mapping cluster events watched to cluster reconcile requests |
| 1515 | func (r *ClusterReconciler) mapSecretsToClusters() handler.MapFunc { |
no outgoing calls
no test coverage detected