func SetEtcdOwnerReference(meta *metav1.ObjectMeta, e *v1alpha1.EtcdCluster) {
	ref := metav1.OwnerReference{
		APIVersion:         v1alpha1.SchemeGroupVersion.String(),
		Kind:               "EtcdCluster",
		Name:               e.Name,
		UID:                e.UID,
		Controller:         pointer.BoolPtr(true),
		BlockOwnerDeletion: pointer.BoolPtr(true),
	}

	found := false

	for idx, r := range meta.OwnerReferences {
		if r.Name == ref.Name && r.APIVersion == v1alpha1.SchemeGroupVersion.String() && r.Kind == "EtcdCluster" {
			found = true
			meta.OwnerReferences[idx] = ref
			break
		}
	}

	if !found {
		meta.OwnerReferences = append(meta.OwnerReferences, ref)
	}
}
// SetEtcdOwnerReference is responsible for setting the object's owner to the specified EtcdCluster
SetEtcdOwnerReference is responsible for setting the object's owner to the specified EtcdCluster
// SetEtcdOwnerReference is responsible for setting the object ' s owner to the specified EtcdCluster
func SetEtcdOwnerReference(meta *metav1.ObjectMeta, e *v1alpha1.EtcdCluster) {
	ref := metav1.OwnerReference{
		APIVersion:         v1alpha1.SchemeGroupVersion.String(),
		Kind:               "EtcdCluster",
		Name:               e.Name,
		UID:                e.UID,
		Controller:         pointer.BoolPtr(true),
		BlockOwnerDeletion: pointer.BoolPtr(true),
	}
	found := false
	for idx, r := range meta.OwnerReferences {
		if r.Name == ref.Name && r.APIVersion == v1alpha1.SchemeGroupVersion.String() && r.Kind == "EtcdCluster" {
			found = true
			meta.OwnerReferences[idx] = ref
			break
		}
	}
	if !found {
		meta.OwnerReferences = append(meta.OwnerReferences, ref)
	}
}
func SetEtcdOwnerReference ( meta * metav1 . ObjectMeta , e * v1alpha1 . EtcdCluster ) { ref := metav1 . OwnerReference { APIVersion : v1alpha1 . SchemeGroupVersion . String ( ) , Kind : " " , Name : e . Name , UID : e . UID , Controller : pointer . BoolPtr ( true ) , BlockOwnerDeletion : pointer . BoolPtr ( true ) , } found := false for idx , r := range meta . OwnerReferences { if r . Name == ref . Name && r . APIVersion == v1alpha1 . SchemeGroupVersion . String ( ) && r . Kind == " " { found = true meta . OwnerReferences [ idx ] = ref break } } if ! found { meta . OwnerReferences = append ( meta . OwnerReferences , ref ) } }
SetEtcdOwnerReference is responsible for setting the object's owner to the specified EtcdCluster
SetEtcdOwnerReference is responsible for setting the object ' s owner to the specified EtcdCluster