func (tcc *Controller) resolveTikvClusterFromSet(namespace string, set *apps.StatefulSet) *v1alpha1.TikvCluster {
	controllerRef := metav1.GetControllerOf(set)
	if controllerRef == nil {
		return nil
	}

	// We can't look up by UID, so look up by Name and then verify UID.
	// Don't even try to look up by Name if it's the wrong Kind.
	if controllerRef.Kind != controller.ControllerKind.Kind {
		return nil
	}
	tc, err := tcc.tcLister.TikvClusters(namespace).Get(controllerRef.Name)
	if err != nil {
		return nil
	}
	if tc.UID != controllerRef.UID {
		// The controller we found with this Name is not the same one that the
		// ControllerRef points to.
		return nil
	}
	return tc
}
// resolveTikvClusterFromSet returns the TikvCluster by a StatefulSet,
// or nil if the StatefulSet could not be resolved to a matching TikvCluster
// of the correct Kind.
resolveTikvClusterFromSet returns the TikvCluster by a StatefulSet,
or nil if the StatefulSet could not be resolved to a matching TikvCluster
of the correct Kind.
// resolveTikvClusterFromSet returns the TikvCluster by a StatefulSet // or nil if the StatefulSet could not be resolved to a matching TikvCluster // of the correct Kind .
func (tcc *Controller) resolveTikvClusterFromSet(namespace string, set *apps.StatefulSet) *v1alpha1.TikvCluster {
	controllerRef := metav1.GetControllerOf(set)
	if controllerRef == nil {
		return nil
	}
	if controllerRef.Kind != controller.ControllerKind.Kind {
		return nil
	}
	tc, err := tcc.tcLister.TikvClusters(namespace).Get(controllerRef.Name)
	if err != nil {
		return nil
	}
	if tc.UID != controllerRef.UID {
		return nil
	}
	return tc
}
func ( tcc * Controller ) resolveTikvClusterFromSet ( namespace string , set * apps . StatefulSet ) * v1alpha1 . TikvCluster { controllerRef := metav1 . GetControllerOf ( set ) if controllerRef == nil { return nil } if controllerRef . Kind != controller . ControllerKind . Kind { return nil } tc , err := tcc . tcLister . TikvClusters ( namespace ) . Get ( controllerRef . Name ) if err != nil { return nil } if tc . UID != controllerRef . UID { return nil } return tc }
resolveTikvClusterFromSet returns the TikvCluster by a StatefulSet,
or nil if the StatefulSet could not be resolved to a matching TikvCluster
of the correct Kind.
resolveTikvClusterFromSet returns the TikvCluster by a StatefulSet or nil if the StatefulSet could not be resolved to a matching TikvCluster of the correct Kind .
// We can't look up by UID, so look up by Name and then verify UID. // Don't even try to look up by Name if it's the wrong Kind. // The controller we found with this Name is not the same one that the // ControllerRef points to.