From 528392ac5bcef96a651b510e591e5fbcd2ba6066 Mon Sep 17 00:00:00 2001 From: Joseph Date: Tue, 5 Aug 2025 12:59:28 -0400 Subject: [PATCH] Added struct change Signed-off-by: Joseph --- design/wildcard-namespace-support-design.md | 64 +++++++++++++++++---- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/design/wildcard-namespace-support-design.md b/design/wildcard-namespace-support-design.md index 13d0fdcb3..d95390812 100644 --- a/design/wildcard-namespace-support-design.md +++ b/design/wildcard-namespace-support-design.md @@ -60,31 +60,75 @@ The implementation involves four main components that can be developed increment ### Add new status fields to the backup and restore CRDs to store expanded wildcard namespaces +#### Backup + ```go -// BackupStatus captures the current status of a Velero backup. -type BackupStatus struct { - // ... existing fields ... - - // IncludeWildcardMatches records the expanded include wildcard namespaces +// WildcardNamespaceStatus contains information about wildcard namespace matching results +type WildcardNamespaceStatus struct { + // IncludeWildcardMatches records the namespaces that matched include wildcard patterns // +optional // +nullable IncludeWildcardMatches []string `json:"includeWildcardMatches,omitempty"` - // ExcludeWildcardMatches records the expanded exclude wildcard namespaces + // ExcludeWildcardMatches records the namespaces that matched exclude wildcard patterns // +optional // +nullable ExcludeWildcardMatches []string `json:"excludeWildcardMatches,omitempty"` // WildcardResult records the final namespaces after applying wildcard include/exclude logic - // +optional - // +nullable - WildcardResult []string `json:"wildcardResult,omitempty"` + // +optional + // +nullable + WildcardResult []string `json:"wildcardResult,omitempty"` +} + +// BackupStatus captures the current status of a Velero backup. +type BackupStatus struct { + // ... existing fields ... + + // WildcardNamespaces contains information about wildcard namespace processing + // +optional + // +nullable + WildcardNamespaces *WildcardNamespaceStatus `json:"wildcardNamespaces,omitempty"` // ... other fields ... } ``` -**Implementation**: Added status fields `IncludeWildcardMatches`, `ExcludeWildcardMatches`, and `WildcardResult` to `pkg/apis/velero/v1/backup_types.go` and `pkg/apis/velero/v1/restore_types.go` to track the resolved namespace lists after wildcard expansion. +#### Restore + +```go +// WildcardNamespaceStatus contains information about wildcard namespace matching results +type WildcardNamespaceStatus struct { + // IncludeWildcardMatches records the namespaces that matched include wildcard patterns + // +optional + // +nullable + IncludeWildcardMatches []string `json:"includeWildcardMatches,omitempty"` + + // ExcludeWildcardMatches records the namespaces that matched exclude wildcard patterns + // +optional + // +nullable + ExcludeWildcardMatches []string `json:"excludeWildcardMatches,omitempty"` + + // WildcardResult records the final namespaces after applying wildcard include/exclude logic + // +optional + // +nullable + WildcardResult []string `json:"wildcardResult,omitempty"` +} + +// RestoreStatus captures the current status of a Velero restore. +type RestoreStatus struct { + // ... existing fields ... + + // WildcardNamespaces contains information about wildcard namespace processing + // +optional + // +nullable + WildcardNamespaces *WildcardNamespaceStatus `json:"wildcardNamespaces,omitempty"` + + // ... other fields ... +} +``` + +**Implementation**: Added a structured `WildcardNamespaceStatus` type and `WildcardNamespaces` field to `pkg/apis/velero/v1/backup_types.go` and `pkg/apis/velero/v1/restore_types.go` to track the resolved namespace lists after wildcard expansion in a well-organized manner. ### Create a util package for wildcard expansion