// reconcileFieldExport handles updates to `FieldExport` resources
reconcileFieldExport handles updates to `FieldExport` resources
// reconcileFieldExport handles updates to ` FieldExport ` resources
func (r *fieldExportReconciler) reconcileFieldExport(ctx context.Context, req ctrlrt.Request) error {
	feObject, err := r.getFieldExport(ctx, req)
	if err != nil {
		return client.IgnoreNotFound(err)
	}
	sourceGK := feObject.Spec.From.Resource.GroupKind
	sourceName := types.NamespacedName{
		Name: *feObject.Spec.From.Resource.Name,
		Namespace: req.Namespace,
	}
	if feObject.DeletionTimestamp != nil {
		return r.cleanup(ctx, feObject)
	}
	var controllerRMF acktypes.AWSResourceManagerFactory
	for _, v := range r.sc.GetResourceManagerFactories() {
		controllerRMF = v
		break
	}
	if sourceGK.Group != controllerRMF.ResourceDescriptor().GroupKind().Group {
		ackrtlog.DebugFieldExport(r.log, feObject, "target resource API group is not of this service. no-op")
		return nil
	}
	if err := r.markManaged(ctx, feObject); err != nil {
		return err
	}
	rmf, ok := (r.sc.GetResourceManagerFactories())[sourceGK.String()]
	if !ok {
		return ackerr.ResourceManagerFactoryNotFound
	}
	sourceObject, err := r.getSourceResource(ctx, rmf.ResourceDescriptor(), sourceName)
	if err != nil {
		if client.IgnoreNotFound(err) != nil {
			return requeue.None(err)
		}
		return nil
	}
	_, err = r.Sync(ctx, sourceObject, *feObject)
	return err
}
func ( r * fieldExportReconciler ) reconcileFieldExport ( ctx context . Context , req ctrlrt . Request ) error { feObject , err := r . getFieldExport ( ctx , req ) if err != nil { return client . IgnoreNotFound ( err ) } sourceGK := feObject . Spec . From . Resource . GroupKind sourceName := types . NamespacedName { Name : * feObject . Spec . From . Resource . Name , Namespace : req . Namespace , } if feObject . DeletionTimestamp != nil { return r . cleanup ( ctx , feObject ) } var controllerRMF acktypes . AWSResourceManagerFactory for _ , v := range r . sc . GetResourceManagerFactories ( ) { controllerRMF = v break } if sourceGK . Group != controllerRMF . ResourceDescriptor ( ) . GroupKind ( ) . Group { ackrtlog . DebugFieldExport ( r . log , feObject , " " ) return nil } if err := r . markManaged ( ctx , feObject ) ; err != nil { return err } rmf , ok := ( r . sc . GetResourceManagerFactories ( ) ) [ sourceGK . String ( ) ] if ! ok { return ackerr . ResourceManagerFactoryNotFound } sourceObject , err := r . getSourceResource ( ctx , rmf . ResourceDescriptor ( ) , sourceName ) if err != nil { if client . IgnoreNotFound ( err ) != nil { return requeue . None ( err ) } return nil } _ , err = r . Sync ( ctx , sourceObject , * feObject ) return err }
reconcileFieldExport handles updates to `FieldExport` resources
reconcileFieldExport handles updates to ` FieldExport ` resources
// We only support pulling from resources in // the same namespace // Check if the target API group matches with the controller // Look up the rmf for the given target resource GVK // Attempt an initial export