Merge branch 'main' into batch-delete-snapshot

This commit is contained in:
Lyndon-Li
2024-02-18 14:54:01 +08:00
164 changed files with 1121 additions and 489 deletions
+1 -1
View File
@@ -155,7 +155,7 @@ func NewInstallOptions() *Options {
DefaultVolumesToFsBackup: false,
UploaderType: uploader.KopiaType,
DefaultSnapshotMoveData: false,
DisableInformerCache: true,
DisableInformerCache: false,
ScheduleSkipImmediately: false,
}
}
+6
View File
@@ -171,6 +171,12 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
schedule.Spec.Template.ResourcePolicy = &v1.TypedLocalObjectReference{Kind: resourcepolicies.ConfigmapRefType, Name: o.BackupOptions.ResPoliciesConfigmap}
}
if o.BackupOptions.ParallelFilesUpload > 0 {
schedule.Spec.Template.UploaderConfig = &api.UploaderConfigForBackup{
ParallelFilesUpload: o.BackupOptions.ParallelFilesUpload,
}
}
if printed, err := output.PrintWithFormat(c, schedule); printed || err != nil {
return err
}
+9 -3
View File
@@ -33,6 +33,7 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
corev1api "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
@@ -88,8 +89,8 @@ const (
defaultResourceTerminatingTimeout = 10 * time.Minute
// server's client default qps and burst
defaultClientQPS float32 = 20.0
defaultClientBurst int = 30
defaultClientQPS float32 = 100.0
defaultClientBurst int = 100
defaultClientPageSize int = 500
defaultProfilerAddress = "localhost:6060"
@@ -467,7 +468,12 @@ func setDefaultBackupLocation(ctx context.Context, client ctrlclient.Client, nam
backupLocation := &velerov1api.BackupStorageLocation{}
if err := client.Get(ctx, types.NamespacedName{Namespace: namespace, Name: defaultBackupLocation}, backupLocation); err != nil {
return errors.WithStack(err)
if apierrors.IsNotFound(err) {
logger.WithField("backupStorageLocation", defaultBackupLocation).WithError(err).Warn("Failed to set default backup storage location at server start")
return nil
} else {
return errors.WithStack(err)
}
}
if !backupLocation.Spec.Default {
+9
View File
@@ -409,4 +409,13 @@ func Test_setDefaultBackupLocation(t *testing.T) {
nonDefaultLocation := &velerov1api.BackupStorageLocation{}
require.Nil(t, c.Get(context.Background(), client.ObjectKey{Namespace: "velero", Name: "non-default"}, nonDefaultLocation))
assert.False(t, nonDefaultLocation.Spec.Default)
// no default location specified
c = fake.NewClientBuilder().WithScheme(scheme).Build()
err := setDefaultBackupLocation(context.Background(), c, "velero", "", logrus.New())
assert.NoError(t, err)
// no default location created
err = setDefaultBackupLocation(context.Background(), c, "velero", "default", logrus.New())
assert.NoError(t, err)
}