github.com/argoproj-labs/argocd-operator@v0.10.0/controllers/argocdexport/storage.go (about)

     1  // Copyright 2019 ArgoCD Operator Developers
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  // 	http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package argocdexport
    16  
    17  import (
    18  	"context"
    19  
    20  	argoproj "github.com/argoproj-labs/argocd-operator/api/v1alpha1"
    21  	"github.com/argoproj-labs/argocd-operator/common"
    22  )
    23  
    24  // reconcileStorage will ensure that the storage options for the ArgoCDExport are present.
    25  func (r *ReconcileArgoCDExport) reconcileStorage(cr *argoproj.ArgoCDExport) error {
    26  	if cr.Spec.Storage == nil {
    27  		cr.Spec.Storage = &argoproj.ArgoCDExportStorageSpec{
    28  			Backend: common.ArgoCDExportStorageBackendLocal,
    29  		}
    30  		return r.Client.Update(context.TODO(), cr)
    31  	}
    32  
    33  	// Local storage
    34  	if err := r.reconcileLocalStorage(cr); err != nil {
    35  		return err
    36  	}
    37  
    38  	return nil
    39  }