Non-admin Restore for OADP CLI#113
Open
Joeavaikath wants to merge 3 commits intomigtools:oadp-devfrom
Open
Conversation
Add create and get subcommands for non-admin restores following the established pattern from backup commands. Phase 1 provides core functionality for creating restores from backups and viewing restore status, enabling users to perform restore operations through both noun-verb and verb-noun command syntax. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com>
Add three new commands to complete the non-admin restore functionality: - describe: Display detailed restore information with optional --details flag for RestoreResults, RestoreItemOperations, and RestoreResourceList - logs: Stream restore operation logs using NonAdminDownloadRequest - delete: Delete restore CRs with --confirm and --all flags All commands support both noun-verb (restore describe) and verb-noun (describe restore) orderings, work with 'na' shorthand, and use the 'kubectl oadp' prefix in examples. Key features: - --details flag for additional restore information (describe only) - --request-timeout flag for download operations (describe and logs) - --confirm flag to skip confirmation prompts (delete only) - --all flag to delete all restores in namespace (delete only) - Color-coded phase display (green/yellow/red) - Restore-specific fields: backup name, namespace mappings, restore PVs - Comprehensive test coverage with 51 passing tests Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com>
Open
Signed-off-by: Joseph <jvaikath@redhat.com>
617af3b to
1e4164d
Compare
kaovilai
reviewed
Feb 5, 2026
Comment on lines
+73
to
+93
| type CreateOptions struct { | ||
| Name string | ||
| BackupName string | ||
| IncludeNamespaces flag.StringArray | ||
| ExcludeNamespaces flag.StringArray | ||
| IncludeResources flag.StringArray | ||
| ExcludeResources flag.StringArray | ||
| NamespaceMappings flag.Map | ||
| Labels flag.Map | ||
| Annotations flag.Map | ||
| Selector flag.LabelSelector | ||
| OrSelector flag.OrLabelSelector | ||
| RestoreVolumes flag.OptionalBool | ||
| PreserveNodePorts flag.OptionalBool | ||
| IncludeClusterResources flag.OptionalBool | ||
| ExistingResourcePolicy string | ||
| ItemOperationTimeout time.Duration | ||
| ResourceModifierConfigMap string | ||
| client kbclient.WithWatch | ||
| currentNamespace string | ||
| } |
Member
There was a problem hiding this comment.
Out of curiosity, I tried importing "github.com/vmware-tanzu/velero/pkg/cmd/cli/restore"
type CreateOptions struct {
restore.CreateOptions
Name string
client kbclient.WithWatch
currentNamespace string
}
func NewCreateOptions() *CreateOptions {
return &CreateOptions{
CreateOptions: restore.CreateOptions{
Labels: flag.NewMap(),
Annotations: flag.NewMap(),
NamespaceMappings: flag.NewMap(),
},
}
}Seems to compile. Could be anti-pattern tho..
Anyway this would add writesparsefiles and other settings which is in non-admin CRD. Thoughts on why some settings are missing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why the changes were made
This PR completes Phase 2 of the non-admin restore commands implementation, adding
describe,logs, anddeletefunctionality to match the feature parity with non-adminbackup commands.
Phase 1 (already merged) provided
createandgetcommands for non-admin restores.Phase 2 adds the remaining essential operations:
describe- Enables users to view detailed restore information including status,progress, and configuration. The
--detailsflag provides access to RestoreResults,RestoreItemOperations, and RestoreResourceList via NonAdminDownloadRequest.
logs- Allows users to troubleshoot restore operations by streaming logs directlyfrom the CLI, essential for debugging failed or in-progress restores.
delete- Provides safe deletion of restore resources with confirmation prompts andbatch deletion support via
--allflag.These commands follow the same patterns established by the backup commands, ensuring
consistency across the CLI. All commands support both noun-verb (
restore describe) andverb-noun (
describe restore) orderings, making the UX flexible and intuitive.How to test the changes made
Prerequisites