Dedup the entries in backuprequest.spec.excludeNamespaces (#10562)
Run the E2E test on kind / setup-test-matrix (push) Failing after 4s
e2e-test-kind.yaml / extract (push) Failing after 8s
Run the E2E test on kind / get-go-version (push) Failing after 9s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 5s
Scorecard supply-chain security / Scorecard analysis (push) Skipped
Main CI / get-go-version (push) Failing after 6s
Main CI / Build (push) Skipped

This commit fixes the issue that when a namespace with label velero.io/exclude-from-backup: "true"
is added to the exludeNamespaces of a backup CR.  There will be
duplicated entries of the namespace in the spec of the backup.

Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com>
This commit is contained in:
Daniel Jiang
2026-09-24 15:02:47 +08:00
committed by GitHub
parent 4407481a9b
commit dfabab70bf
3 changed files with 122 additions and 0 deletions
+4
View File
@@ -544,6 +544,10 @@ func (b *backupReconciler) prepareBackupRequest(ctx context.Context, backup *vel
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("error getting namespace list: %v", err))
}
if len(request.Spec.ExcludedNamespaces) > 0 {
request.Spec.ExcludedNamespaces = sets.NewString(request.Spec.ExcludedNamespaces...).List()
}
// validate whether Included/Excluded resources and IncludedClusterResource are mixed with
// Included/Excluded cluster-scoped/namespace-scoped resources.
if oldAndNewFilterParametersUsedTogether(request.Spec) {