Skip to content
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

Support multi-part backup #109

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f4cf8c6
Dockerfile: use ceph-export-diff-v16.2.4.3
ushitora-anqou Feb 19, 2025
438d349
add fields necessary for multi-part backup to MantleBackup CRD
ushitora-anqou Feb 19, 2025
2fdff77
chore: rename export() to startExportAndUpload() using startExport() …
ushitora-anqou Feb 19, 2025
11c3837
implement multi-part backup
ushitora-anqou Feb 19, 2025
bbc8905
charts/mantle: support .values.controller.backupTransferPartSize
ushitora-anqou Feb 19, 2025
d614278
test: fix existing unit tests to support multi-part backup
ushitora-anqou Feb 19, 2025
079f063
test/e2e: multik8s: fix existing tests to support multi-part backup
ushitora-anqou Feb 19, 2025
855827e
test/e2e: replication: check largestCompleted{Export,Upload,Import} i…
ushitora-anqou Feb 13, 2025
647ac77
fix to check all of the import Jobs are completed
ushitora-anqou Feb 13, 2025
b9e6c17
test/e2e: multik8s: test if snapshot is correctly created
ushitora-anqou Feb 13, 2025
ef58777
test/e2e: multik8s: add nolint:gocyclo to replicationTestSuite
ushitora-anqou Feb 13, 2025
8d127ac
test/e2e: multik8s: attach various-transfer-part-size label
ushitora-anqou Feb 19, 2025
c17b53e
ci: run test/e2e/multik8s with different part sizes
ushitora-anqou Feb 19, 2025
d834d91
test/e2e: multik8s: make sure backup succeeds if backup-transfer-part…
ushitora-anqou Feb 13, 2025
ea634a6
test/e2e: multik8s: test parallel backups
ushitora-anqou Feb 14, 2025
ee54d0d
test: chore: simplify
ushitora-anqou Feb 17, 2025
f95ea9d
test: check completed export and upload Jobs are deleted
ushitora-anqou Feb 17, 2025
4270515
test: check completed import Jobs are deleted
ushitora-anqou Feb 18, 2025
30b7155
test: check {primary,secondary}Cleanup don't delete unrelated resources
ushitora-anqou Feb 18, 2025
53eede2
test: check original part size is used if it's changed during reconci…
ushitora-anqou Feb 18, 2025
5c8946a
test/e2e: multik8s: check middle snapshots are deleted
ushitora-anqou Feb 18, 2025
61a969e
fixup! add fields necessary for multi-part backup to MantleBackup CRD
ushitora-anqou Feb 25, 2025
d80eece
fixup! implement multi-part backup
ushitora-anqou Feb 25, 2025
ac87ce9
fixup! fix to check all of the import Jobs are completed
ushitora-anqou Feb 25, 2025
1e6947b
fixup! implement multi-part backup
ushitora-anqou Feb 26, 2025
ad392bb
fixup! test: fix existing unit tests to support multi-part backup
ushitora-anqou Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
_ "k8s.io/client-go/plugin/pkg/client/auth"

"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
Expand Down Expand Up @@ -50,6 +51,7 @@ var (
role string
mantleServiceEndpoint string
maxExportJobs int
maxUploadJobs int
exportDataStorageClass string
envSecret string
objectStorageBucketName string
Expand All @@ -60,6 +62,7 @@ var (
httpProxy string
httpsProxy string
noProxy string
backupTransferPartSize string

scheme = runtime.NewScheme()
setupLog = ctrl.Log.WithName("setup")
Expand All @@ -86,6 +89,8 @@ func init() {
"this option is required and is interpreted as the address that the secondary mantle should listen to.")
flags.IntVar(&maxExportJobs, "max-export-jobs", 8,
"The maximum number of export jobs that can run simultaneously. If you set this to 0, there is no limit.")
flags.IntVar(&maxUploadJobs, "max-upload-jobs", 8,
"The maximum number of export jobs that can run simultaneously. If you set this to 0, there is no limit.")
flags.StringVar(&exportDataStorageClass, "export-data-storage-class", "",
"The storage class of PVCs used to store exported data temporarily.")
flags.StringVar(&envSecret, "env-secret", "",
Expand All @@ -107,6 +112,8 @@ func init() {
"The proxy URL for HTTPS requests to the object storage and the gRPC endpoint of secondary mantle.")
flags.StringVar(&noProxy, "no-proxy", "",
"A string that contains comma-separated values specifying hosts that should be excluded from proxying.")
flags.StringVar(&backupTransferPartSize, "backup-transfer-part-size", "200Gi",
"The size of each backup data chunk to be transferred at a time.")

goflags := flag.NewFlagSet("goflags", flag.ExitOnError)
zapOpts.Development = true
Expand Down Expand Up @@ -174,6 +181,12 @@ func setupReconcilers(mgr manager.Manager, primarySettings *controller.PrimarySe
return err
}

parsedBackupTransferPartSize, err := resource.ParseQuantity(backupTransferPartSize)
if err != nil {
setupLog.Error(err, "failed to parse backup-transfer-part-size", "value", backupTransferPartSize)
return fmt.Errorf("failed to parse backup-transfer-part-size: %w", err)
}

backupReconciler := controller.NewMantleBackupReconciler(
mgr.GetClient(),
mgr.GetScheme(),
Expand All @@ -193,6 +206,7 @@ func setupReconcilers(mgr manager.Manager, primarySettings *controller.PrimarySe
HttpsProxy: httpsProxy,
NoProxy: noProxy,
},
parsedBackupTransferPartSize,
)
if err := backupReconciler.SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "MantleBackup")
Expand Down Expand Up @@ -287,6 +301,7 @@ func setupPrimary(ctx context.Context, mgr manager.Manager, wg *sync.WaitGroup)
Conn: conn,
Client: proto.NewMantleServiceClient(conn),
MaxExportJobs: maxExportJobs,
MaxUploadJobs: maxUploadJobs,
ExportDataStorageClass: exportDataStorageClass,
}

Expand Down
Loading