-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow sparse option for Kopia & Restic restore #7141
Allow sparse option for Kopia & Restic restore #7141
Conversation
af6adc7
to
b2f8bbe
Compare
fe45ccd
to
076c9a3
Compare
076c9a3
to
7cff2f1
Compare
a34a85f
to
dfb8935
Compare
dfb8935
to
fd77ba8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that the new uploaded config needs to be added at https://velero.io/docs/v1.12/api-types/restore/.
@@ -122,5 +122,44 @@ Roughly, the process is as follows: | |||
3. Each respective controller within the CRs calls the uploader, and the ParallelFilesUpload from UploaderConfig in CRs is passed to the uploader. | |||
4. When the uploader subsequently calls the Kopia API, it can use the ParallelFilesUpload to set the MaxParallelFileReads parameter, and if the uploader calls the Restic command it would output one warning log for Restic does not support this feature. | |||
|
|||
### Sparse Option For Kopia & Restic Restore | |||
In many system files, there are numerous zero bytes or empty blocks that still occupy physical storage space. Sparse backup employs a more intelligent approach by only backing up the actual data-containing portions. For those empty blocks or zero bytes, it merely records their presence without actually storing them. This can significantly reduce the storage space required for backups, especially in situations where there is a substantial amount of empty data in large file systems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is describing the backup but this section is about sparse restore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the design, and I'll add the design later
fd77ba8
to
0571fd2
Compare
ae3461c
to
bfc6b68
Compare
bfc6b68
to
0fc7e5f
Compare
0fc7e5f
to
7b95b3c
Compare
…pport-restore-sparse
7b95b3c
to
0afaa70
Compare
939def8
to
ded375c
Compare
pkg/apis/velero/v1/backup_types.go
Outdated
UploaderConfigForBackup *UploaderConfigForBackup `json:"uploaderConfig,omitempty"` | ||
} | ||
|
||
// UploaderConfigForBackup defines the configuration for the backup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inaccurate comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -177,6 +177,11 @@ func DescribeRestore(ctx context.Context, kbClient kbclient.Client, restore *vel | |||
d.Println() | |||
d.Printf("Preserve Service NodePorts:\t%s\n", BoolPointerString(restore.Spec.PreserveNodePorts, "false", "true", "auto")) | |||
|
|||
if restore.Spec.UploaderConfigForRestore != nil && *restore.Spec.UploaderConfigForRestore.WriteSparseFiles { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a risk of nil pointer b/c restore.Spec.UploaderConfigForRestore.WriteSparseFiles
may also be nil, you should use boolptr.IsSetToTrue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
pkg/apis/velero/v1/restore_types.go
Outdated
// UploaderConfig specifies the configuration for the restore. | ||
// +optional | ||
// +nullable | ||
UploaderConfigForRestore *UploaderConfigForRestore `json:"uploaderConfig,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: for simplicity and consistency with json key and comment, the name of the Field in the struct should better be UploaderConfig
, there won't be confusion, b/c normally the code would look like
restore.Spec.UploaderConfig .....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
} | ||
|
||
func StoreRestoreConfig(config *velerov1api.UploaderConfigForRestore) map[string]string { | ||
data := make(map[string]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this cause inconsistency for different uploaders?
Can we be sure that the default value is always false for different uploaders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
return data | ||
} | ||
|
||
func GetBackupConfig(data map[string]string) (velerov1api.UploaderConfigForBackup, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if reusing velerov1api.UploaderConfigForBackup
is a good approach, there may be settings in PVB that is meaningful to the uploader but is not exposed in backup CR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
ded375c
to
2f00ea9
Compare
Signed-off-by: Ming Qiu <mqiu@vmware.com>
2f00ea9
to
1a237d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #(issue)
#6664
map[string]string
Please indicate you've done the following:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.