mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 13:55:20 +00:00
@@ -103,3 +103,7 @@ func (r *Request) FillVolumesInformation() {
|
|||||||
r.VolumesInformation.BackupOperations = *r.GetItemOperationsList()
|
r.VolumesInformation.BackupOperations = *r.GetItemOperationsList()
|
||||||
r.VolumesInformation.BackupName = r.Backup.Name
|
r.VolumesInformation.BackupName = r.Backup.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Request) StopWorkerPool() {
|
||||||
|
r.WorkerPool.Stop()
|
||||||
|
}
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ func (b *backupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
|
|||||||
log.Debug("Preparing backup request")
|
log.Debug("Preparing backup request")
|
||||||
request := b.prepareBackupRequest(ctx, original, log)
|
request := b.prepareBackupRequest(ctx, original, log)
|
||||||
// delete worker pool after reconcile
|
// delete worker pool after reconcile
|
||||||
defer request.WorkerPool.Stop()
|
defer request.StopWorkerPool()
|
||||||
if len(request.Status.ValidationErrors) > 0 {
|
if len(request.Status.ValidationErrors) > 0 {
|
||||||
request.Status.Phase = velerov1api.BackupPhaseFailedValidation
|
request.Status.Phase = velerov1api.BackupPhaseFailedValidation
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
corev1api "k8s.io/api/core/v1"
|
corev1api "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/builder"
|
"sigs.k8s.io/controller-runtime/pkg/builder"
|
||||||
@@ -154,11 +155,7 @@ func (r *backupQueueReconciler) detectNamespaceConflict(ctx context.Context, bac
|
|||||||
}
|
}
|
||||||
|
|
||||||
func detectNSConflictsInternal(backup *velerov1api.Backup, earlierBackups []velerov1api.Backup, clusterNamespaces []string) (bool, string) {
|
func detectNSConflictsInternal(backup *velerov1api.Backup, earlierBackups []velerov1api.Backup, clusterNamespaces []string) (bool, string) {
|
||||||
backupNamespaces := namespacesForBackup(backup, clusterNamespaces)
|
backupNamespaces := sets.NewString(namespacesForBackup(backup, clusterNamespaces)...)
|
||||||
backupNSMap := make(map[string]struct{})
|
|
||||||
for _, ns := range backupNamespaces {
|
|
||||||
backupNSMap[ns] = struct{}{}
|
|
||||||
}
|
|
||||||
for _, earlierBackup := range earlierBackups {
|
for _, earlierBackup := range earlierBackups {
|
||||||
// This will never be true for the primary backup, but for the secondary
|
// This will never be true for the primary backup, but for the secondary
|
||||||
// runnability check for queued backups ahead of the current backup, we
|
// runnability check for queued backups ahead of the current backup, we
|
||||||
@@ -168,11 +165,8 @@ func detectNSConflictsInternal(backup *velerov1api.Backup, earlierBackups []vele
|
|||||||
earlierBackup.Status.QueuePosition >= backup.Status.QueuePosition {
|
earlierBackup.Status.QueuePosition >= backup.Status.QueuePosition {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
runningNSList := namespacesForBackup(&earlierBackup, clusterNamespaces)
|
if backupNamespaces.HasAny(namespacesForBackup(&earlierBackup, clusterNamespaces)...) {
|
||||||
for _, runningNS := range runningNSList {
|
return true, earlierBackup.Name
|
||||||
if _, found := backupNSMap[runningNS]; found {
|
|
||||||
return true, earlierBackup.Name
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false, ""
|
return false, ""
|
||||||
|
|||||||
Reference in New Issue
Block a user