MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / IsOwnedByCluster

Function IsOwnedByCluster

internal/controller/cluster_controller.go:1497–1512  ·  view source on GitHub ↗

IsOwnedByCluster checks that an object is owned by a Cluster and returns the owner name

(obj client.Object)

Source from the content-addressed store, hash-verified

1495// IsOwnedByCluster checks that an object is owned by a Cluster and returns
1496// the owner name
1497func 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
1515func (r *ClusterReconciler) mapSecretsToClusters() handler.MapFunc {

Callers 14

DestroyFunction · 0.92
ensurePodIsDeletedFunction · 0.92
jobOwnerIndexFuncFunction · 0.85
createFieldIndexesMethod · 0.85
mapNodeToClustersMethod · 0.85
serviceReconcilerMethod · 0.85
createOrPatchPodMonitorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected