func (r *ReconcileArgoCDExport) reconcilePVC(cr *argoprojv1a1.ArgoCDExport) error {
	if cr.Status.Phase == common.ArgoCDStatusCompleted {
		return nil // Nothing to see here, move along...
	}

	pvc := argoutil.NewPersistentVolumeClaim(cr.ObjectMeta)
	if argoutil.IsObjectFound(r.client, cr.Namespace, pvc.Name, pvc) {
		return nil // PVC exists, move along...
	}

	// Allow override of PVC spec
	if cr.Spec.Storage.PVC != nil {
		pvc.Spec = *cr.Spec.Storage.PVC
	} else {
		pvc.Spec.AccessModes = []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}
		pvc.Spec.Resources = argoutil.DefaultPVCResources()
	}

	if err := controllerutil.SetControllerReference(cr, pvc, r.scheme); err != nil {
		return err
	}

	// Create PVC
	log.Info(fmt.Sprintf("creating new pvc: %s", pvc.Name))
	if err := r.client.Create(context.TODO(), pvc); err != nil {
		return err
	}

	// Create event
	log.Info("creating new event")
	return argoutil.CreateEvent(r.client, "Exporting", "Created claim for export process.", "PersistentVolumeClaimCreated", cr.ObjectMeta)
}
// reconcilePVC will ensure that the PVC for the ArgoCDExport is present.
reconcilePVC will ensure that the PVC for the ArgoCDExport is present.
// reconcilePVC will ensure that the PVC for the ArgoCDExport is present .
func (r *ReconcileArgoCDExport) reconcilePVC(cr *argoprojv1a1.ArgoCDExport) error {
	if cr.Status.Phase == common.ArgoCDStatusCompleted {
		return nil 
	}
	pvc := argoutil.NewPersistentVolumeClaim(cr.ObjectMeta)
	if argoutil.IsObjectFound(r.client, cr.Namespace, pvc.Name, pvc) {
		return nil 
	}
	if cr.Spec.Storage.PVC != nil {
		pvc.Spec = *cr.Spec.Storage.PVC
	} else {
		pvc.Spec.AccessModes = []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}
		pvc.Spec.Resources = argoutil.DefaultPVCResources()
	}
	if err := controllerutil.SetControllerReference(cr, pvc, r.scheme); err != nil {
		return err
	}
	log.Info(fmt.Sprintf("creating new pvc: %s", pvc.Name))
	if err := r.client.Create(context.TODO(), pvc); err != nil {
		return err
	}
	log.Info("creating new event")
	return argoutil.CreateEvent(r.client, "Exporting", "Created claim for export process.", "PersistentVolumeClaimCreated", cr.ObjectMeta)
}
func ( r * ReconcileArgoCDExport ) reconcilePVC ( cr * argoprojv1a1 . ArgoCDExport ) error { if cr . Status . Phase == common . ArgoCDStatusCompleted { return nil } pvc := argoutil . NewPersistentVolumeClaim ( cr . ObjectMeta ) if argoutil . IsObjectFound ( r . client , cr . Namespace , pvc . Name , pvc ) { return nil } if cr . Spec . Storage . PVC != nil { pvc . Spec = * cr . Spec . Storage . PVC } else { pvc . Spec . AccessModes = [ ] corev1 . PersistentVolumeAccessMode { corev1 . ReadWriteOnce } pvc . Spec . Resources = argoutil . DefaultPVCResources ( ) } if err := controllerutil . SetControllerReference ( cr , pvc , r . scheme ) ; err != nil { return err } log . Info ( fmt . Sprintf ( " " , pvc . Name ) ) if err := r . client . Create ( context . TODO ( ) , pvc ) ; err != nil { return err } log . Info ( " " ) return argoutil . CreateEvent ( r . client , " " , " " , " " , cr . ObjectMeta ) }
reconcilePVC will ensure that the PVC for the ArgoCDExport is present.
reconcilePVC will ensure that the PVC for the ArgoCDExport is present .
// Nothing to see here, move along... // PVC exists, move along... // Allow override of PVC spec // Create PVC // Create event