From ba5bad45457e3b623c02672d1be617fa39e5013a Mon Sep 17 00:00:00 2001 From: Jack Lin Date: Tue, 16 Jul 2024 16:37:05 +0800 Subject: [PATCH] feat(backupbackingimage): add parameters to backup backing image create proto ref: longhorn/longhorn 8884 Signed-off-by: Jack Lin --- backupbackingimage/backupbackingimage.go | 7 +++++++ backupbackingimage/config.go | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- vendor/modules.txt | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/backupbackingimage/backupbackingimage.go b/backupbackingimage/backupbackingimage.go index 635235ac0..01f0f8585 100644 --- a/backupbackingimage/backupbackingimage.go +++ b/backupbackingimage/backupbackingimage.go @@ -10,6 +10,8 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" + lhbackup "github.com/longhorn/go-common-libs/backup" + "github.com/longhorn/backupstore" "github.com/longhorn/backupstore/common" "github.com/longhorn/backupstore/types" @@ -31,6 +33,8 @@ type BackupBackingImage struct { CompressionMethod string CreatedTime string CompleteTime string + Secret string + SecretNamespace string ProcessingBlocks *common.ProcessingBlocks @@ -41,6 +45,7 @@ type BackupConfig struct { Name string DestURL string ConcurrentLimit int32 + Parameters map[string]string } type RestoreConfig struct { @@ -180,6 +185,8 @@ func performBackup(bsDriver backupstore.BackupStoreDriver, config *BackupConfig, backupBackingImage.Blocks = common.SortBackupBlocks(backupBackingImage.Blocks, backupBackingImage.Size, mappings.BlockSize) backupBackingImage.CompleteTime = util.Now() backupBackingImage.BlockCount = totalBlockCounts + backupBackingImage.Secret = config.Parameters[lhbackup.LonghornBackupBackingImageParameterSecret] + backupBackingImage.SecretNamespace = config.Parameters[lhbackup.LonghornBackupBackingImageParameterSecretNamespace] if err := saveBackingImageConfig(bsDriver, backupBackingImage); err != nil { return progress.Progress, "", err } diff --git a/backupbackingimage/config.go b/backupbackingimage/config.go index b4c6123a2..6af28d23f 100644 --- a/backupbackingimage/config.go +++ b/backupbackingimage/config.go @@ -184,6 +184,8 @@ type BackupInfo struct { Checksum string Labels map[string]string CompressionMethod string `json:",omitempty"` + Secret string + SecretNamespace string } func InspectBackupBackingImage(backupURL string) (*BackupInfo, error) { @@ -217,5 +219,7 @@ func fillFullBackupBackingImageInfo(backupBackingImage *BackupBackingImage, dest Checksum: backupBackingImage.Checksum, Labels: backupBackingImage.Labels, CompressionMethod: backupBackingImage.CompressionMethod, + Secret: backupBackingImage.Secret, + SecretNamespace: backupBackingImage.SecretNamespace, } } diff --git a/go.mod b/go.mod index 414445395..6e389c1d3 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/aws/aws-sdk-go v1.55.5 github.com/gammazero/workerpool v1.1.3 github.com/google/uuid v1.6.0 - github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e + github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f github.com/pierrec/lz4/v4 v4.1.21 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 diff --git a/go.sum b/go.sum index 1533946ac..4159c80e9 100644 --- a/go.sum +++ b/go.sum @@ -98,8 +98,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e h1:cmns0zh6HMocqH7tnjFrgI8mf/h1i0bbnLznWfjQ63k= -github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e/go.mod h1:Yrq49KPpchy++7Z15GrMKPkiwr5IduPboLTL99a1TGA= +github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f h1:hjqUs3WVodkzrWwlUMVsnKAlom3uohoNlhZBGLsRvQY= +github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f/go.mod h1:Qv34svr/msf6XoUwnrltNBTwMhQljbHEhb5ZKWiRdxo= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= diff --git a/vendor/modules.txt b/vendor/modules.txt index 13d8a6a7b..487729db9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -139,7 +139,7 @@ github.com/kr/pretty # github.com/kr/text v0.2.0 ## explicit github.com/kr/text -# github.com/longhorn/go-common-libs v0.0.0-20240811024046-b6ddc3efb72e +# github.com/longhorn/go-common-libs v0.0.0-20240821134112-907f57efd48f ## explicit; go 1.22.0 github.com/longhorn/go-common-libs/backup # github.com/matttproud/golang_protobuf_extensions v1.0.1