From 56e6e7164895f5d5cfc94441176c40f13d10bc88 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Mon, 28 Oct 2024 15:02:25 -0500 Subject: [PATCH] initial design thoughts --- design/kopia-to-local-volume-provider.md | 76 ++++++++++++++++++++++++ pkg/repository/config/config.go | 3 +- pkg/repository/provider/unified_repo.go | 2 + 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 design/kopia-to-local-volume-provider.md diff --git a/design/kopia-to-local-volume-provider.md b/design/kopia-to-local-volume-provider.md new file mode 100644 index 00000000000..e2ecab9d293 --- /dev/null +++ b/design/kopia-to-local-volume-provider.md @@ -0,0 +1,76 @@ +# Kopia Backup to Local Volume Provider (PVC/NFS) + +_Note_: The preferred style for design documents is one sentence per line. +*Do not wrap lines*. +This aids in review of the document as changes to a line are not obscured by the reflowing those changes caused and has a side effect of avoiding debate about one or two space after a period. + +_Note_: The name of the file should follow the name pattern `_design.md`, e.g: +`listener-design.md`. + +## Abstract +Backups involving kopia are currently stored to blob storage only, this proposal aims to add support for storing backups to local volumes (PVC/NFS). + +## Background +Users have asked for the ability to store backups to local volumes (PVC/NFS) for various reasons including: +- Compliance requirements +- Cost + - Existing infrastructure +- Performance +- Flexibility + +## Goals + + +## Non Goals + + + +## High-Level Design +if backup storage location is a local volume (PVC/NFS) then: + +Add a new backend type `PVCBackend` to `pkg/repository/config/config.go` + +```go +const ( + AWSBackend BackendType = "velero.io/aws" + AzureBackend BackendType = "velero.io/azure" + GCPBackend BackendType = "velero.io/gcp" + FSBackend BackendType = "velero.io/fs" + PVCBackend BackendType = "replicated.com/pvc" +) +``` + +This plugin will be responsible for storing backups to a local volume PVC which can be NFS backed. + +When `PVCBackend` is configured, velero will use kopia to store backups to the local volume instead of blob storage. + +## Detailed Design +A detailed design describing how the changes to the product should be made. + +The names of types, fields, interfaces, and methods should be agreed on here, not debated in code review. +The same applies to changes in CRDs, YAML examples, and so on. + +Ideally the changes should be made in sequence so that the work required to implement this design can be done incrementally, possibly in parallel. + +## Alternatives Considered +If there are alternative high level or detailed designs that were not pursued they should be called out here with a brief explanation of why they were not pursued. + +## Security Considerations +If this proposal has an impact to the security of the product, its users, or data stored or transmitted via the product, they must be addressed here. + +## Compatibility +A discussion of any compatibility issues that need to be considered + +## Implementation +A description of the implementation, timelines, and any resources that have agreed to contribute. + +## Open Issues + + +Velero Logs, Velero Downloads will still not work and will be solved in [Download server for Velero client #6167 +](https://github.com/vmware-tanzu/velero/issues/6167) \ No newline at end of file diff --git a/pkg/repository/config/config.go b/pkg/repository/config/config.go index c1ef8b906c3..cab5810977f 100644 --- a/pkg/repository/config/config.go +++ b/pkg/repository/config/config.go @@ -34,6 +34,7 @@ const ( AzureBackend BackendType = "velero.io/azure" GCPBackend BackendType = "velero.io/gcp" FSBackend BackendType = "velero.io/fs" + PVCBackend BackendType = "replicated.com/pvc" // CredentialsFileKey is the key within a BSL config that is checked to see if // the BSL is using its own credentials, rather than those in the environment @@ -109,7 +110,7 @@ func GetBackendType(provider string, config map[string]string) BackendType { } func IsBackendTypeValid(backendType BackendType) bool { - return (backendType == AWSBackend || backendType == AzureBackend || backendType == GCPBackend || backendType == FSBackend) + return (backendType == AWSBackend || backendType == AzureBackend || backendType == GCPBackend || backendType == FSBackend || backendType == PVCBackend) } // GetRepoIdentifier returns the string to be used as the value of the --repo flag in diff --git a/pkg/repository/provider/unified_repo.go b/pkg/repository/provider/unified_repo.go index ac77e5b66ed..fb19ece63e8 100644 --- a/pkg/repository/provider/unified_repo.go +++ b/pkg/repository/provider/unified_repo.go @@ -444,6 +444,8 @@ func getStorageType(backupLocation *velerov1api.BackupStorageLocation) string { return udmrepo.StorageTypeGcs case repoconfig.FSBackend: return udmrepo.StorageTypeFs + case repoconfig.PVCBackend: + return udmrepo.StorageTypeFs default: return "" }