Pass Velero server command args to the plugins

Pass Velero server command args to the plugins

Fixes #7806

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
This commit is contained in:
Wenkai Yin(尹文开)
2024-07-23 14:54:41 +08:00
parent 981f30cb25
commit dc6eeafe98
22 changed files with 500 additions and 483 deletions

View File

@@ -30,6 +30,7 @@ import (
"github.com/vmware-tanzu/velero/internal/storage"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/constant"
"github.com/vmware-tanzu/velero/pkg/persistence"
"github.com/vmware-tanzu/velero/pkg/plugin/clientmgmt"
"github.com/vmware-tanzu/velero/pkg/util/kube"
@@ -80,7 +81,7 @@ func (r *backupStorageLocationReconciler) Reconcile(ctx context.Context, req ctr
var unavailableErrors []string
var location velerov1api.BackupStorageLocation
log := r.log.WithField("controller", BackupStorageLocation).WithField(BackupStorageLocation, req.NamespacedName.String())
log := r.log.WithField("controller", constant.ControllerBackupStorageLocation).WithField(constant.ControllerBackupStorageLocation, req.NamespacedName.String())
log.Debug("Validating availability of BackupStorageLocation")
locationList, err := storage.ListBackupStorageLocations(r.ctx, r.client, req.Namespace)
@@ -155,7 +156,7 @@ func (r *backupStorageLocationReconciler) logReconciledPhase(defaultFound bool,
var availableBSLs []*velerov1api.BackupStorageLocation
var unAvailableBSLs []*velerov1api.BackupStorageLocation
var unknownBSLs []*velerov1api.BackupStorageLocation
log := r.log.WithField("controller", BackupStorageLocation)
log := r.log.WithField("controller", constant.ControllerBackupStorageLocation)
for i, location := range locationList.Items {
phase := location.Status.Phase
@@ -198,7 +199,7 @@ func (r *backupStorageLocationReconciler) SetupWithManager(mgr ctrl.Manager) err
)
gp := kube.NewGenericEventPredicate(func(object client.Object) bool {
location := object.(*velerov1api.BackupStorageLocation)
return storage.IsReadyToValidate(location.Spec.ValidationFrequency, location.Status.LastValidationTime, r.defaultBackupLocationInfo.ServerValidationFrequency, r.log.WithField("controller", BackupStorageLocation))
return storage.IsReadyToValidate(location.Spec.ValidationFrequency, location.Status.LastValidationTime, r.defaultBackupLocationInfo.ServerValidationFrequency, r.log.WithField("controller", constant.ControllerBackupStorageLocation))
})
return ctrl.NewControllerManagedBy(mgr).
// As the "status.LastValidationTime" field is always updated, this triggers new reconciling process, skip the update event that include no spec change to avoid the reconcile loop