Merge https://github.com/velero-io/velero:main (7d300ea) into oadp-dev#554
Merge https://github.com/velero-io/velero:main (7d300ea) into oadp-dev#554oadp-rebasebot-app[bot] wants to merge 78 commits into
Conversation
Introduces a --default-resource-modifier-configmap server flag that references a ConfigMap with resource modifier rules applied automatically to all restores. This eliminates per-restore configuration for common transformations like stripping stale CNI annotations (OVN-Kubernetes, Multus) that can break workloads after restore. Key design decisions: - Exclusive precedence: per-restore modifiers fully replace the default - Non-fatal default errors: misconfigured default does not break restores - Opt-out via SkipDefaultResourceModifier field in RestoreSpec - Ships with a curated example ConfigMap for CNI annotation stripping Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
- Use *bool for SkipDefaultResourceModifier to match RestoreSpec conventions - Use boolptr.IsSetToTrue for nil-safe bool check in controller logic - Fix warning message to say "failed to retrieve" instead of "not found" - Add Restore Describe Output subsection covering all resolved states - Only set SkipDefaultResourceModifier from CLI when flag is true Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
* Fix PodVolumeBackup metadata loss on fs-backup timeout When a backup hits the fs-backup timeout, WaitAllPodVolumesProcessed returned nil because PVBs were only collected from the indexer in the done branch of the select. This discarded all PVB metadata including already-completed PVBs, making their data unrestorable. Move the PVB collection loop to run after the select so tracked PVBs are always persisted regardless of timeout. Fixes velero-io#9986 Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com> * Add changelog for PR velero-io#9995 Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com> * Filter non-completed PVBs in hasPodVolumeBackup After preserving tracked PVBs on timeout, non-completed PVBs (in-progress or with no snapshot ID) would cause hasPodVolumeBackup to return true, leading the restore to skip the original PV and dynamically re-provision it without any data to restore from. Only match PVBs that are Completed with a valid SnapshotID. Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com> * Add unit tests for hasPodVolumeBackup phase filtering Verify that hasPodVolumeBackup only matches PVBs that are Completed with a valid SnapshotID, and rejects in-progress, failed, or empty-snapshot PVBs. Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com> --------- Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
Add repository guard (github.repository == 'velero-io/velero') to workflows that should only run on the upstream repo. This prevents unnecessary CI runs on forks like openshift/velero where these workflows either fail due to missing secrets/config or duplicate fork-specific CI. Guarded workflows: auto_assign_prs, auto_label_prs, auto_request_review, e2e-test-kind, nightly-trivy-scan, pr-changelog-check, pr-codespell, pr-filepath-check, pr-linter-check, prow-action, rebase, stale-issues. Intentionally left unguarded: pr-ci-check (useful for contributors on forks), get-go-version (reusable workflow_call only). Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
Per review feedback, these workflows are useful on forks: - e2e-test-kind: tests pass on downstream forks - pr-linter-check: keeps lint up to date for upstream-bound features - nightly-trivy-scan: wanted in downstream forks Also remove changelog file per reviewer request. Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
…workflows-on-forks Skip upstream-only workflows on forks
Signed-off-by: Daniel Jiang <daniel.jiang@broadcom.com>
…e policy action Signed-off-by: chlins <chlins.zhang@gmail.com>
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
Add BackupType in backup.spec.
…ault-resource-modifier Design: Server default restore resource modifier
* add block dev operations for block data mover backup Signed-off-by: Lyndon-Li <lyonghui@vmware.com> * add block dev operations for block data mover backup Signed-off-by: Lyndon-Li <lyonghui@vmware.com> * Add block device operations for block uploader backup Signed-off-by: Lyndon-Li <lyonghui@vmware.com> * Add block device operations for block uploader backup Signed-off-by: Lyndon-Li <lyonghui@vmware.com> --------- Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
feat(resourcepolicies): support dataMover parameter in snapshot volume
* Add design doc for dynamic CLI resource autocompletion Proposes adding ValidArgsFunction and RegisterFlagCompletionFunc to all Velero CLI commands that accept existing resource names, covering 20 commands and 5 flags across 6 resource types. Signed-off-by: Joseph <jvaikath@redhat.com> * Update design doc to reflect implementation details - Document the shared completeNames helper using apimachinery's meta.ExtractList/Accessor instead of six duplicated functions - Add 3-second timeout, deep-copy, and per-item error resilience details - Update generics alternative to explain why they were unnecessary - Add testing section describing unit test coverage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com> * Add RBAC and bash compatibility notes to design doc - Note that users without list permission receive empty completions - Document bash 4.0+ requirement and macOS bash 3.2 workarounds Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com> * Add issue reference to design doc abstract Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com> * Address PR review comments: add debug flag completion and arg deduplication - Add `debug --backup` and `--restore` to flag completion table (chlins) - Document deduplication of already-typed args in completeNames (chlins) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com> * Trim design doc to focus on reviewable decisions Remove implementation mechanics (code snippets, type alias justification, deep-copy rationale, closure internals) that are verifiable from code. Drop bash v1-to-v2 migration (v1 already supports ValidArgsFunction). Fix flag count from 7 to 9 (add schedule create inherited flags). Add Open Issues section for single-arg commands, comma-separated flag values, and optional v2 migration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joseph <jvaikath@redhat.com> --------- Signed-off-by: Joseph <jvaikath@redhat.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Initial plan * Remove restic references from main docs * Refine Kopia-only performance and maintenance docs --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Shubham Pampattiwar <spampatt@redhat.com>
Signed-off-by: lou <alex1988@outlook.com> Co-authored-by: lou <alex1988@outlook.com>
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
1. Skip deleting the restore files from storage if the backup/BSL is not found 2. Allow deleting the restore files from storage even though the BSL is readonly Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
Add PSA audit and warn labels. Signed-off-by: Xun Jiang <jxun@vmware.com>
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
Signed-off-by: allenxu404 <qix2@vmware.com>
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
(cherry picked from commit 8e01d1b) Signed-off-by: David Zaninovic <dzaninovic@catalogicsoftware.com>
Replace the base image with paketobuildpacks image Fixes velero-io#6851 Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
…l format Upstream velero switched golangci-lint installation from the curl-based installer to `go install` in the v1.18.2-rc.2 cycle. The version extraction regex in Makefile.prow only matched the old curl pattern, causing an empty version string and a checksum verification failure in CI. Update the extraction to handle both the old `curl | sh` format and the new `go install ... @vX.Y.Z` format. For v2+, use `go install` directly; for v1.x, fall back to the curl installer. Closes openshift#519 Signed-off-by: Joseph Vaikath <jvaikath@redhat.com> Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Joseph Vaikath <jvaikath@redhat.com> Signed-off-by: Joseph <jvaikath@redhat.com>
Go 1.26 introduced stricter go vet checks for non-constant format strings. The EventRecorder.Event and EndingEvent methods had variadic signatures (message string, a ...any) that caused go vet to treat the message parameter as a printf format string, flagging all calls where a variable was passed as the message. This removes the variadic parameters from Event and EndingEvent and has all callers pre-format their messages with fmt.Sprintf instead. This eliminates the printf-like function signature that triggered the vet warnings while preserving identical runtime behavior.
|
Hi @oadp-rebasebot-app[bot]. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: oadp-rebasebot-app[bot] The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThis PR adds backup type support, centralizes data mover handling, implements Linux block-device operations, preserves pod-volume results during cancellation, scopes repository automation, updates Kopia-focused documentation, and adds design proposals and changelog entries. ChangesBackup type support
Data mover selection
Block uploader and restore handling
Repository automation and documentation
Estimated code review effort: 5 (Critical) | ~90+ minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 12 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/ok-to-test |
There was a problem hiding this comment.
Actionable comments posted: 12
🧹 Nitpick comments (3)
pkg/uploader/block/dev_linux_test.go (1)
182-327: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd successful read and write opening cases.
The tests never verify that read mode passes
O_RDONLY|O_DIRECTand write mode passesO_RDWR|O_DIRECT. Capture the injectedopenFileFuncarguments and return a temporary file for both positive cases.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/uploader/block/dev_linux_test.go` around lines 182 - 327, Extend TestOpenBlockDevice with successful read and write cases that use a fake block-device lstat result, capture the flags passed to injectOpenFile, and return a temporary file handle. Assert read mode uses O_RDONLY|O_DIRECT and write mode uses O_RDWR|O_DIRECT, while preserving the existing error-case coverage.design/cli-dynamic-resource-completion_design.md (2)
117-119: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winSpecify comma-aware completion for repeated flag values.
--volume-snapshot-locationsonly completes the first value; subsequent values receive the full comma-delimited string. Define splitting and prefix replacement, or explicitly narrow the feature scope and add coverage.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@design/cli-dynamic-resource-completion_design.md` around lines 117 - 119, Update the design for --volume-snapshot-locations to define comma-aware completion: split the comma-delimited input, complete the current value, and replace only that value while preserving the others. If this behavior is intentionally out of scope, explicitly narrow the completion requirements and add coverage for the documented limitation.
113-115: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDefine maximum-argument handling before implementation.
Single-argument commands can receive suggestions after an argument is already present, producing invalid completions. Add a shared maximum-argument check (or per-command wrapper) and test
backup logsandbackup download.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@design/cli-dynamic-resource-completion_design.md` around lines 113 - 115, Update the dynamic resource completion design to define maximum-argument handling before implementation: ensure the completion function or per-command wrappers stop returning suggestions once the command’s allowed positional argument count is reached. Apply this to the single-argument `backup logs` and `backup download` commands, and specify tests covering completion after one argument is provided.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@changelogs/unreleased/9994-Lyndon-Li`:
- Line 1: Update the changelog entry to mention that block-device operations
support both block uploader backup and restore paths, not backup alone.
In `@design/default-resource-modifier_design.md`:
- Around line 277-289: The restore configuration currently persists only the
skip flag, so the describer cannot reliably represent the resolved default
modifier later. Persist resolved default state in the restore data, including
the applied ConfigMap name/source and whether it was skipped or ignored due to
retrieval or validation failure, then update the restore describer in
restore_describer.go to use that persisted state: show the ConfigMap for applied
defaults, the skip reason for SkipDefaultResourceModifier, and no extra output
for per-restore overrides or failed defaults.
In `@internal/resourcepolicies/resource_policies.go`:
- Around line 60-64: The validDataMovers allow-list must recognize the
documented empty-string default alias. Add the empty string to validDataMovers,
and add regression coverage showing Action.validate accepts dataMover "" and
GetDataMover returns it unchanged.
In `@pkg/cmd/cli/backup/create.go`:
- Around line 240-246: Update CreateOptions.validateBackupType to assign the
trimmed backupType back to o.BackupType after successful validation, so
BuildBackup submits the canonical enum value. Add an assertion covering
generated Backup.Spec.BackupType for whitespace-padded input and verifying it
contains the expected trimmed value.
In `@pkg/restore/restore_test.go`:
- Line 4264: Update the fixture conversion in the test helper around
runtime.DefaultUnstructuredConverter.ToUnstructured to capture its error and
assert require.NoError(t, err) before using the converted object, preventing a
failed conversion from producing a broken PV fixture.
In `@pkg/uploader/block/dev_linux_test.go`:
- Around line 65-68: Update every temporary-file setup and cleanup block in the
test to assert close results with require.NoError(t, f.Close()). Apply this
consistently to the file handles created in the affected test cases, including
the blocks around the visible os.CreateTemp call, without leaving any bare
f.Close() calls.
In `@pkg/uploader/block/dev_linux.go`:
- Around line 35-56: In the device-opening flow after openFileFunc returns, call
device.Stat() and verify the opened descriptor’s mode identifies a block device,
rather than relying only on the earlier lstatFunc check. On Stat failure or
non-block results, close the descriptor and return an appropriate error;
preserve the existing successfully opened device path otherwise.
In `@pkg/uploader/block/snapshot.go`:
- Line 70: Update the deferred device cleanup in Restore and the other affected
function around sourceInfo.dev.Close so Close errors are not discarded. Use
deferred closures that access the named return error and join or wrap any close
failure into it, preserving existing errors while returning device-finalization
failures.
In `@pkg/util/datamover/datamover.go`:
- Around line 32-42: The built-in classification in IsBuiltInDataMover does not
recognize the resolved default or specialized built-in movers. Separate legacy
empty/“velero” alias handling from built-in classification, and update
IsBuiltInDataMover to accept DataMoverTypeVeleroFs and DataMoverTypeVeleroBlock
while preserving existing aliases. Add regression tests covering
GetDefaultBuiltInDataMover’s result and both specialized movers.
In `@site/content/docs/main/api-types/backup.md`:
- Around line 181-187: Update the backupType documentation near the BackupType
field to match the implemented and tested default of Incremental, changing only
the omitted-value default description unless the project explicitly chooses Full
as the contract. Keep the documented backup behavior and supported backup modes
unchanged.
In `@site/content/docs/main/backup-repository-configuration.md`:
- Line 21: Revise the backup repository configuration documentation to clarify
that ConfigMap entries, rather than the ConfigMap itself, are keyed by
repository type such as <kopia> or <other-repository-type>. State that each
entry applies to all BackupRepository CRs of the matching type, while
repositoryConfig changes remain specific to individual CRs.
In `@site/content/docs/main/performance-guidance.md`:
- Around line 124-125: Revise the performance conclusions around the Kopia
uploader to match the measured timings: remove the claim that it becomes faster,
avoid unsupported “less time-consuming” and timeout statements, and describe
only the observed runtime increases and memory behavior unless the missing
comparison measurements are added.
---
Nitpick comments:
In `@design/cli-dynamic-resource-completion_design.md`:
- Around line 117-119: Update the design for --volume-snapshot-locations to
define comma-aware completion: split the comma-delimited input, complete the
current value, and replace only that value while preserving the others. If this
behavior is intentionally out of scope, explicitly narrow the completion
requirements and add coverage for the documented limitation.
- Around line 113-115: Update the dynamic resource completion design to define
maximum-argument handling before implementation: ensure the completion function
or per-command wrappers stop returning suggestions once the command’s allowed
positional argument count is reached. Apply this to the single-argument `backup
logs` and `backup download` commands, and specify tests covering completion
after one argument is provided.
In `@pkg/uploader/block/dev_linux_test.go`:
- Around line 182-327: Extend TestOpenBlockDevice with successful read and write
cases that use a fake block-device lstat result, capture the flags passed to
injectOpenFile, and return a temporary file handle. Assert read mode uses
O_RDONLY|O_DIRECT and write mode uses O_RDWR|O_DIRECT, while preserving the
existing error-case coverage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 6bfedd07-566c-4d11-b963-65d2c55748e3
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (56)
.github/CODEOWNERS.github/workflows/auto_assign_prs.yml.github/workflows/auto_label_prs.yml.github/workflows/auto_request_review.yml.github/workflows/pr-changelog-check.yml.github/workflows/pr-codespell.yml.github/workflows/pr-filepath-check.yml.github/workflows/prow-action.yml.github/workflows/rebase.yml.github/workflows/stale-issues.ymlchangelogs/unreleased/10004-chlinschangelogs/unreleased/9921-shubham-pampattiwarchangelogs/unreleased/9954-blackpigletchangelogs/unreleased/9994-Lyndon-Lichangelogs/unreleased/9995-shubham-pampattiwarconfig/crd/v1/bases/velero.io_backups.yamlconfig/crd/v1/bases/velero.io_schedules.yamlconfig/crd/v1/crds/crds.godesign/cli-dynamic-resource-completion_design.mddesign/default-resource-modifier_design.mdgo.modinternal/resourcepolicies/resource_policies.gointernal/resourcepolicies/resource_policies_test.gointernal/resourcepolicies/volume_resources_validator.gointernal/resourcepolicies/volume_resources_validator_test.gopkg/apis/velero/v1/backup_types.gopkg/builder/backup_builder.gopkg/cmd/cli/backup/create.gopkg/cmd/cli/backup/create_test.gopkg/controller/backup_controller.gopkg/controller/backup_controller_test.gopkg/controller/data_download_controller.gopkg/controller/data_upload_controller.gopkg/datamover/dataupload_delete_action.gopkg/datamover/util.gopkg/datamover/util_test.gopkg/exposer/csi_snapshot.gopkg/exposer/csi_snapshot_test.gopkg/exposer/generic_restore.gopkg/exposer/generic_restore_test.gopkg/podvolume/backupper.gopkg/podvolume/backupper_test.gopkg/restore/restore.gopkg/restore/restore_test.gopkg/uploader/block/dev_linux.gopkg/uploader/block/dev_linux_test.gopkg/uploader/block/snapshot.gopkg/util/datamover/datamover.gopkg/util/datamover/datamover_test.goresticsite/content/docs/main/api-types/backup.mdsite/content/docs/main/backup-repository-configuration.mdsite/content/docs/main/file-system-backup.mdsite/content/docs/main/performance-guidance.mdsite/content/docs/main/repository-maintenance.mdsite/content/docs/main/self-signed-certificates.md
💤 Files with no reviewable changes (1)
- pkg/datamover/util_test.go
| @@ -0,0 +1 @@ | |||
| Add block device operations for block uploader backup No newline at end of file | |||
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Mention restore support in the changelog.
The implementation adds block-device handling to both backup and restore paths.
-Add block device operations for block uploader backup
+Add block device operations for block uploader backup and restore📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Add block device operations for block uploader backup | |
| Add block device operations for block uploader backup and restore |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@changelogs/unreleased/9994-Lyndon-Li` at line 1, Update the changelog entry
to mention that block-device operations support both block uploader backup and
restore paths, not backup alone.
| Update the restore describer in `pkg/cmd/util/output/restore_describer.go` to show which resource modifier was applied and its source. | ||
| The describe output should reflect the resolved state: | ||
|
|
||
| - When the default resource modifier was applied, display its ConfigMap name and source: | ||
| ``` | ||
| Default Resource Modifier: default-restore-resource-modifiers | ||
| ``` | ||
| - When the default was skipped because `SkipDefaultResourceModifier` is true: | ||
| ``` | ||
| Default Resource Modifier: skipped (SkipDefaultResourceModifier=true) | ||
| ``` | ||
| - When the default was skipped because a per-restore modifier was specified, no extra output is needed since the per-restore modifier is already displayed under the existing `Resource Modifier` field. | ||
| - When the default was ignored due to a validation or retrieval error, the warning is already logged to the restore log. The describe output should not surface transient errors. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Persist resolved default state before promising describe output.
Only the skip flag is stored; the ConfigMap name, source, and whether loading succeeded are not persisted. The describer therefore cannot reliably report applied, skipped, or failed default modifiers after configuration changes. Add status fields/events for the resolved state, or remove this output requirement.
🧰 Tools
🪛 LanguageTool
[style] ~289-~289: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...e existing Resource Modifier field. - When the default was ignored due to a valida...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🪛 markdownlint-cli2 (0.23.0)
[warning] 281-281: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 285-285: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@design/default-resource-modifier_design.md` around lines 277 - 289, The
restore configuration currently persists only the skip flag, so the describer
cannot reliably represent the resolved default modifier later. Persist resolved
default state in the restore data, including the applied ConfigMap name/source
and whether it was skipped or ignored due to retrieval or validation failure,
then update the restore describer in restore_describer.go to use that persisted
state: show the ConfigMap for applied defaults, the skip reason for
SkipDefaultResourceModifier, and no extra output for per-restore overrides or
failed defaults.
| var validDataMovers = map[string]struct{}{ | ||
| datamover.DataMoverTypeVelero: {}, | ||
| datamover.DataMoverTypeVeleroFs: {}, | ||
| datamover.DataMoverTypeVeleroBlock: {}, | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Allow the documented empty-string alias.
GetDataMover documents "" as a default alias (Lines 78-80), but this allow-list rejects it. Since Action.validate uses the same map, a policy with dataMover: "" cannot be accepted or returned unchanged. Add "": {} and regression cases for both validation and GetDataMover.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/resourcepolicies/resource_policies.go` around lines 60 - 64, The
validDataMovers allow-list must recognize the documented empty-string default
alias. Add the empty string to validDataMovers, and add regression coverage
showing Action.validate accepts dataMover "" and GetDataMover returns it
unchanged.
| func (o *CreateOptions) validateBackupType() error { | ||
| backupType := strings.TrimSpace(o.BackupType) | ||
|
|
||
| switch backupType { | ||
| case "", "Incremental", "Full": | ||
| default: | ||
| return fmt.Errorf("invalid backup type %s - valid values are 'Incremental', and 'Full'", backupType) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Normalize the validated backup type before building the request.
validateBackupType() trims into a local variable but leaves o.BackupType unchanged. Therefore, " Incremental " passes validation and BuildBackup() submits the untrimmed value, which violates the CRD enum and causes the create request to fail.
Assign the trimmed value back after successful validation, and add an assertion that the generated Backup.Spec.BackupType contains the canonical enum value.
Proposed fix
switch backupType {
case "", "Incremental", "Full":
default:
return fmt.Errorf("invalid backup type %s - valid values are 'Incremental', and 'Full'", backupType)
}
+ o.BackupType = backupType
return nilAlso applies to: 414-415
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/cmd/cli/backup/create.go` around lines 240 - 246, Update
CreateOptions.validateBackupType to assign the trimmed backupType back to
o.BackupType after successful validation, so BuildBackup submits the canonical
enum value. Add an assertion covering generated Backup.Spec.BackupType for
whitespace-padded input and verifying it contains the expected trimmed value.
| }, | ||
| }, | ||
| } | ||
| obj, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(pv) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the relevant section of the test file with line numbers.
sed -n '4235,4295p' pkg/restore/restore_test.go | cat -n
# Find the ToUnstructured signature in the local module cache if available via go env.
python3 - <<'PY'
import os, subprocess, sys, json
try:
modcache = subprocess.check_output(["go", "env", "GOMODCACHE"], text=True).strip()
print("GOMODCACHE=", modcache)
except Exception as e:
print("go env failed:", e)
PY
# Search repository for ToUnstructured usages and any handling pattern.
rg -n "DefaultUnstructuredConverter\.ToUnstructured|ToUnstructured\(" pkg -g '!**/vendor/**'
# Locate the imported runtime package and surrounding test helper definitions.
rg -n "runtime\.DefaultUnstructuredConverter|func .*pv|PersistentVolume|unstructured\.Unstructured" pkg/restore/restore_test.goRepository: openshift/velero
Length of output: 28680
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the converter implementation/signature in the local module cache.
modcache="$(go env GOMODCACHE)"
rg -n "func .*ToUnstructured|ToUnstructured\(in interface" "$modcache"/k8s.io/apimachinery@* -g 'converter.go' -g '*.go' | head -n 20
# Show the implementation if found.
impl=$(rg -l "ToUnstructured" "$modcache"/k8s.io/apimachinery@* -g 'converter.go' | head -n 1 || true)
if [ -n "${impl:-}" ]; then
echo "IMPLEMENTATION_FILE=$impl"
sed -n '1,220p' "$impl" | cat -n
fiRepository: openshift/velero
Length of output: 11337
🏁 Script executed:
#!/bin/bash
set -euo pipefail
modcache="$(go env GOMODCACHE)"
rg -n "func .*ToUnstructured|ToUnstructured\(in interface" "$modcache"/k8s.io/apimachinery@* -g 'converter.go' -g '*.go' | head -n 20
impl=$(rg -l "ToUnstructured" "$modcache"/k8s.io/apimachinery@* -g 'converter.go' | head -n 1 || true)
if [ -n "${impl:-}" ]; then
echo "IMPLEMENTATION_FILE=$impl"
sed -n '1,220p' "$impl" | cat -n
fiRepository: openshift/velero
Length of output: 11337
Handle the unstructured conversion error — runtime.DefaultUnstructuredConverter.ToUnstructured returns an error here; if conversion fails, this fixture helper will build a broken PV and mask the real problem. Capture it and require.NoError(t, err).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/restore/restore_test.go` at line 4264, Update the fixture conversion in
the test helper around runtime.DefaultUnstructuredConverter.ToUnstructured to
capture its error and assert require.NoError(t, err) before using the converted
object, preventing a failed conversion from producing a broken PV fixture.
Source: Path instructions
| return uploader.SnapshotInfo{}, false, errors.Wrapf(err, "error opening block device %s", source) | ||
| } | ||
|
|
||
| defer sourceInfo.dev.Close() |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Propagate device-close failures.
Both deferred calls discard Close() errors. In particular, Restore can return success despite a device finalization failure. Use a deferred closure with a named return error and join/wrap any close failure.
As per path instructions, “Never ignore error returns.”
Also applies to: 223-223
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/uploader/block/snapshot.go` at line 70, Update the deferred device
cleanup in Restore and the other affected function around sourceInfo.dev.Close
so Close errors are not discarded. Use deferred closures that access the named
return error and join or wrap any close failure into it, preserving existing
errors while returning device-finalization failures.
Source: Path instructions
| // IsBuiltInDataMover reports whether the given data mover value refers to a | ||
| // Velero built-in data mover (an empty value or the default "velero" alias). | ||
| func IsBuiltInDataMover(dataMover string) bool { | ||
| return dataMover == "" || dataMover == DataMoverTypeVelero | ||
| } | ||
|
|
||
| // GetDefaultBuiltInDataMover returns the data mover used when the default | ||
| // built-in data mover ("velero"/empty) is selected. The default may change | ||
| // between releases; currently it is the file system data mover. | ||
| func GetDefaultBuiltInDataMover() string { | ||
| return DataMoverTypeVeleroFs |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== datamover utility ==\n'
sed -n '1,220p' pkg/util/datamover/datamover.go
printf '\n== search for built-in mover predicate usages ==\n'
rg -n "IsBuiltInDataMover|GetDefaultBuiltInDataMover|DataMoverTypeVeleroFs|DataMoverTypeVelero|velero-block" pkg -g'*.go'
printf '\n== inspect likely callers ==\n'
rg -n "IsBuiltInDataMover\(" -g'*.go' .Repository: openshift/velero
Length of output: 6234
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== pkg/datamover/util.go ==\n'
sed -n '1,220p' pkg/datamover/util.go
printf '\n== pkg/controller/data_upload_controller.go (relevant region) ==\n'
sed -n '130,220p' pkg/controller/data_upload_controller.go
sed -n '920,980p' pkg/controller/data_upload_controller.go
printf '\n== pkg/controller/data_download_controller.go (relevant region) ==\n'
sed -n '130,190p' pkg/controller/data_download_controller.go
printf '\n== pkg/datamover/dataupload_delete_action.go ==\n'
sed -n '1,160p' pkg/datamover/dataupload_delete_action.go
printf '\n== pkg/util/datamover/datamover_test.go ==\n'
sed -n '1,220p' pkg/util/datamover/datamover_test.goRepository: openshift/velero
Length of output: 16203
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== search for DataMover defaulting/assignment ==\n'
rg -n "DataMover.*Default|default.*DataMover|GetDefaultBuiltInDataMover|DataMoverTypeVeleroFs|DataMoverTypeVeleroBlock|DataMoverTypeVelero" pkg config . -g'*.go' -g'*.yaml' -g'*.yml' -g'*.json'
printf '\n== locate API type definitions for DataMover fields ==\n'
rg -n "DataMover string|DataMover .*string" pkg/apis -g'*.go'
printf '\n== inspect v2alpha1 DataUpload/DataDownload types ==\n'
sed -n '1,260p' pkg/apis/velero/v2alpha1/types.go
printf '\n== inspect any defaulting webhook files ==\n'
rg -n "Defaulting|SetDefaults|defaulter|Webhook|DataMover" pkg/apis pkg -g'*.go'Repository: openshift/velero
Length of output: 6266
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== internal/resourcepolicies/resource_policies.go ==\n'
sed -n '1,180p' internal/resourcepolicies/resource_policies.go
printf '\n== internal/resourcepolicies/volume_resources_validator.go ==\n'
sed -n '1,180p' internal/resourcepolicies/volume_resources_validator.go
printf '\n== search for IsBuiltInDataMover combined with default resolution ==\n'
rg -n "GetDefaultBuiltInDataMover\(\).*IsBuiltInDataMover|IsBuiltInDataMover\([^)]*GetDefaultBuiltInDataMover|GetDefaultBuiltInDataMover\(\)" . -g'*.go'Repository: openshift/velero
Length of output: 12104
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== search for GetDataMover call sites ==\n'
rg -n "\.GetDataMover\(" . -g'*.go'
printf '\n== search for DataUpload/DataDownload creation with dataMover ==\n'
rg -n "DataMover:|Spec\.DataMover|dataMover =" pkg internal -g'*.go'
printf '\n== inspect expose/restoration paths around mover selection ==\n'
sed -n '1,260p' pkg/exposer/generic_restore.go
sed -n '1,260p' pkg/exposer/csi_snapshot.goRepository: openshift/velero
Length of output: 24462
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== pkg/backup/actions/csi/pvc_action.go (data mover assignment) ==\n'
sed -n '520,620p' pkg/backup/actions/csi/pvc_action.go
printf '\n== pkg/restore/actions/csi/pvc_action.go (data mover assignment) ==\n'
sed -n '400,470p' pkg/restore/actions/csi/pvc_action.go
printf '\n== pkg/restore/actions/dataupload_retrieve_action.go ==\n'
sed -n '1,140p' pkg/restore/actions/dataupload_retrieve_action.go
printf '\n== internal/volume/volumes_information.go (data mover extraction) ==\n'
sed -n '600,900p' internal/volume/volumes_information.goRepository: openshift/velero
Length of output: 20729
Expand built-in mover detection
GetDefaultBuiltInDataMover() resolves to velero-fs, but IsBuiltInDataMover() still rejects velero-fs and velero-block. That can make the data upload/download controllers skip valid CRs once the default is stored in Spec.DataMover. Split the legacy ""/velero alias check from built-in classification, and add regression tests for the resolved default and specialized movers.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/util/datamover/datamover.go` around lines 32 - 42, The built-in
classification in IsBuiltInDataMover does not recognize the resolved default or
specialized built-in movers. Separate legacy empty/“velero” alias handling from
built-in classification, and update IsBuiltInDataMover to accept
DataMoverTypeVeleroFs and DataMoverTypeVeleroBlock while preserving existing
aliases. Add regression tests covering GetDefaultBuiltInDataMover’s result and
both specialized movers.
| # BackupType specifies how volume data is backed up, with possible values including Full and Incremental. | ||
| # BackupType is optional. If it's not set, it will default to Full. | ||
| # BackupType is only meaningful for data mover backup, including CSI snapshot fs backup, CSI snapshot block backup, and fs backup. | ||
| # For CSI only backup and Velero native backup, backupType doesn't take effect. | ||
| # Full means data mover will forcefully upload all data in volumes. | ||
| # Incremental means data mover will only upload data change since last snapshot. | ||
| backupType: Full |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Document the actual default backup type.
The documentation says an omitted backupType defaults to Full, but pkg/controller/backup_controller.go Lines 413-416 and its tests default it to Incremental. Update the documentation to say Incremental, or change the implementation and tests consistently if Full is the intended contract.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@site/content/docs/main/api-types/backup.md` around lines 181 - 187, Update
the backupType documentation near the BackupType field to match the implemented
and tested default of Incremental, changing only the omitted-value default
description unless the project explicitly chooses Full as the contract. Keep the
documented backup behavior and supported backup modes unchanged.
| - Otherwise, you can create the backup repository configMap as a template for the BackupRepository CRs that are going to be created. | ||
|
|
||
| The backup repository configMap is repository type (i.e., kopia, restic) specific, so for one repository type, you only need to create one set of configurations, they will be applied to all BackupRepository CRs of the same type. Whereas, the changes of `repositoryConfig` field apply to the specific BackupRepository CR only, you may need to change every BackupRepository CR of the same type. | ||
| The backup repository configMap is repository type specific (for example, `kopia`), so for one repository type, you only need to create one set of configurations, they will be applied to all BackupRepository CRs of the same type. Whereas, the changes of `repositoryConfig` field apply to the specific BackupRepository CR only, you may need to change every BackupRepository CR of the same type. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Clarify the scope of the ConfigMap versus its entries.
The example below places <kopia> and <other-repository-type> keys in one ConfigMap, so saying the ConfigMap itself is repository-type-specific is misleading. Say that configuration entries are keyed by repository type and apply to all matching CRs.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@site/content/docs/main/backup-repository-configuration.md` at line 21, Revise
the backup repository configuration documentation to clarify that ConfigMap
entries, rather than the ConfigMap itself, are keyed by repository type such as
<kopia> or <other-repository-type>. State that each entry applies to all
BackupRepository CRs of the matching type, while repositoryConfig changes remain
specific to individual CRs.
| - With the increasing number of files, there is no memory abnormal surge, and memory usage is linearly increasing until it exceeds 1GB where Case 2.4 Kopia uploader OOM happened. | ||
| - Kopia uploader gets increasingly faster along with the increasing number of files. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align the conclusions with the measured data.
The reported times increase from 2m34s to 3m45s to 5m06s, so “increasingly faster” is unsupported. The summary also claims Kopia is “less time-consuming” without a comparison baseline and mentions timeouts that are not shown in these results. State only conclusions supported by the tables, or add the missing measurements.
Also applies to: 145-148
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@site/content/docs/main/performance-guidance.md` around lines 124 - 125,
Revise the performance conclusions around the Kopia uploader to match the
measured timings: remove the claim that it becomes faster, avoid unsupported
“less time-consuming” and timeout statements, and describe only the observed
runtime increases and memory behavior unless the missing comparison measurements
are added.
|
@oadp-rebasebot-app[bot]: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This is an automated rebase PR generated by RebaseBot.
Summary
https://github.com/velero-io/velero:mainhttps://github.com/openshift/velero:oadp-dev