Skip to content

Commit e5053bb

Browse files
Joeavaikathclaude
andcommitted
Normalize empty includes to * instead of active namespaces list
This ensures consistent behavior between CLI and kubectl-apply paths for Namespace CR inclusion when excludes contain wildcards. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent aedb52d commit e5053bb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

pkg/util/collections/includes_excludes.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ func (nie *NamespaceIncludesExcludes) ExpandIncludesExcludes() error {
164164
return err
165165
}
166166

167-
// If original includes was empty (meaning "include all namespaces"),
168-
// populate expanded includes with all active namespaces. Without this,
169-
// the wildcardExpanded flag combined with empty includes would cause
170-
// ShouldInclude to return false for everything, when only excludes
171-
// contained wildcard patterns.
167+
// Empty includes means "include all", so normalize to "*" to
168+
// prevent the wildcardExpanded+empty guard from excluding
169+
// everything, and to match the CLI path's behavior.
170+
// Note: Namespace CRs for excluded namespaces will still be
171+
// backed up — this is intentional Velero behavior (see
172+
// item_backupper.go itemInclusionChecks).
172173
if len(includes) == 0 {
173-
expandedIncludes = nie.activeNamespaces
174+
expandedIncludes = []string{"*"}
174175
}
175176

176177
nie.SetIncludes(expandedIncludes)

0 commit comments

Comments
 (0)