fix issue 6647

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2023-09-04 16:55:36 +08:00
parent 831be07dd3
commit 778feba3ae
7 changed files with 169 additions and 0 deletions
+11
View File
@@ -46,6 +46,7 @@ type podTemplateConfig struct {
defaultVolumesToFsBackup bool
serviceAccountName string
uploaderType string
defaultSnapshotMoveData bool
}
func WithImage(image string) podTemplateOption {
@@ -136,6 +137,12 @@ func WithDefaultVolumesToFsBackup() podTemplateOption {
}
}
func WithDefaultSnapshotMoveData() podTemplateOption {
return func(c *podTemplateConfig) {
c.defaultSnapshotMoveData = true
}
}
func WithServiceAccountName(sa string) podTemplateOption {
return func(c *podTemplateConfig) {
c.serviceAccountName = sa
@@ -167,6 +174,10 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment
args = append(args, "--default-volumes-to-fs-backup=true")
}
if c.defaultSnapshotMoveData {
args = append(args, "--default-snapshot-move-data=true")
}
if len(c.uploaderType) > 0 {
args = append(args, fmt.Sprintf("--uploader-type=%s", c.uploaderType))
}
+5
View File
@@ -243,6 +243,7 @@ type VeleroOptions struct {
Features []string
DefaultVolumesToFsBackup bool
UploaderType string
DefaultSnapshotMoveData bool
}
func AllCRDs() *unstructured.UnstructuredList {
@@ -343,6 +344,10 @@ func AllResources(o *VeleroOptions) *unstructured.UnstructuredList {
deployOpts = append(deployOpts, WithDefaultVolumesToFsBackup())
}
if o.DefaultSnapshotMoveData {
deployOpts = append(deployOpts, WithDefaultSnapshotMoveData())
}
deploy := Deployment(o.Namespace, deployOpts...)
if err := appendUnstructured(resources, deploy); err != nil {