mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-26 01:44:19 +00:00
Remove wildcard check from getNamespacesToList.
Expand wildcard in namespace filter only for backup scenario. Restore doesn't need that now, because restore has logic to rely on IncludeEverything function to check whether cluster-scoped resources should be restored. Expand wildcard will break the logic. Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
This commit is contained in:
committed by
Xun Jiang/Bruce Jiang
parent
bf9e1f8fd7
commit
8ac8f49b5c
@@ -575,6 +575,14 @@ func (b *backupReconciler) prepareBackupRequest(ctx context.Context, backup *vel
|
||||
request.Status.ValidationErrors = append(request.Status.ValidationErrors, fmt.Sprintf("Invalid included/excluded namespace lists: %v", err))
|
||||
}
|
||||
|
||||
// if included namespaces is empty, default to wildcard to include all namespaces
|
||||
// This is useful for later wildcard expansion logic.
|
||||
// This also align the behavior between backup creation from CLI and from API,
|
||||
// as CLI will default to wildcard if included namespaces is not specified.
|
||||
if request.Spec.IncludedNamespaces == nil {
|
||||
request.Spec.IncludedNamespaces = []string{"*"}
|
||||
}
|
||||
|
||||
// validate that only one exists orLabelSelector or just labelSelector (singular)
|
||||
if request.Spec.OrLabelSelectors != nil && request.Spec.LabelSelector != nil {
|
||||
request.Status.ValidationErrors = append(request.Status.ValidationErrors, "encountered labelSelector as well as orLabelSelectors in backup spec, only one can be specified")
|
||||
|
||||
Reference in New Issue
Block a user