diff --git a/changelogs/unreleased/9069-Lyndon-Li b/changelogs/unreleased/9069-Lyndon-Li new file mode 100644 index 000000000..a97bb3fba --- /dev/null +++ b/changelogs/unreleased/9069-Lyndon-Li @@ -0,0 +1 @@ +Fix issue #8813, remove restic from the valid uploader type \ No newline at end of file diff --git a/pkg/cmd/cli/install/install.go b/pkg/cmd/cli/install/install.go index f455d6d4f..4c1612334 100644 --- a/pkg/cmd/cli/install/install.go +++ b/pkg/cmd/cli/install/install.go @@ -130,7 +130,7 @@ func (o *Options) BindFlags(flags *pflag.FlagSet) { flags.StringVar(&o.CACertFile, "cacert", o.CACertFile, "File containing a certificate bundle to use when verifying TLS connections to the object store. Optional.") flags.StringVar(&o.Features, "features", o.Features, "Comma separated list of Velero feature flags to be set on the Velero deployment and the node-agent daemonset, if node-agent is enabled") flags.BoolVar(&o.DefaultVolumesToFsBackup, "default-volumes-to-fs-backup", o.DefaultVolumesToFsBackup, "Bool flag to configure Velero server to use pod volume file system backup by default for all volumes on all backups. Optional.") - flags.StringVar(&o.UploaderType, "uploader-type", o.UploaderType, fmt.Sprintf("The type of uploader to transfer the data of pod volumes, the supported values are '%s', '%s'", uploader.ResticType, uploader.KopiaType)) + flags.StringVar(&o.UploaderType, "uploader-type", o.UploaderType, fmt.Sprintf("The type of uploader to transfer the data of pod volumes, supported value: '%s'", uploader.KopiaType)) flags.BoolVar(&o.DefaultSnapshotMoveData, "default-snapshot-move-data", o.DefaultSnapshotMoveData, "Bool flag to configure Velero server to move data by default for all snapshots supporting data movement. Optional.") flags.BoolVar(&o.DisableInformerCache, "disable-informer-cache", o.DisableInformerCache, "Disable informer cache for Get calls on restore. With this enabled, it will speed up restore in cases where there are backup resources which already exist in the cluster, but for very large clusters this will increase velero memory usage. Default is false (don't disable). Optional.") flags.BoolVar(&o.ScheduleSkipImmediately, "schedule-skip-immediately", o.ScheduleSkipImmediately, "Skip the first scheduled backup immediately after creating a schedule. Default is false (don't skip).") diff --git a/pkg/cmd/server/config/config.go b/pkg/cmd/server/config/config.go index b9540bf2c..d1577fc58 100644 --- a/pkg/cmd/server/config/config.go +++ b/pkg/cmd/server/config/config.go @@ -207,7 +207,7 @@ func GetDefaultConfig() *Config { LogLevel: logging.LogLevelFlag(logrus.InfoLevel), LogFormat: logging.NewFormatFlag(), DefaultVolumesToFsBackup: podvolumeconfigs.DefaultVolumesToFsBackup, - UploaderType: uploader.ResticType, + UploaderType: uploader.KopiaType, MaxConcurrentK8SConnections: defaultMaxConcurrentK8SConnections, DefaultSnapshotMoveData: false, DisableInformerCache: defaultDisableInformerCache, diff --git a/pkg/controller/pod_volume_backup_controller.go b/pkg/controller/pod_volume_backup_controller.go index 344ccba97..d87cf4d02 100644 --- a/pkg/controller/pod_volume_backup_controller.go +++ b/pkg/controller/pod_volume_backup_controller.go @@ -588,6 +588,11 @@ func (r *PodVolumeBackupReconciler) OnDataPathProgress(ctx context.Context, name func (r *PodVolumeBackupReconciler) SetupWithManager(mgr ctrl.Manager) error { gp := kube.NewGenericEventPredicate(func(object client.Object) bool { pvb := object.(*velerov1api.PodVolumeBackup) + + if _, err := uploader.ValidateUploaderType(pvb.Spec.UploaderType); err != nil { + return false + } + if pvb.Status.Phase == velerov1api.PodVolumeBackupPhaseAccepted { return true } diff --git a/pkg/podvolume/backupper_test.go b/pkg/podvolume/backupper_test.go index 108f22797..38b415a01 100644 --- a/pkg/podvolume/backupper_test.go +++ b/pkg/podvolume/backupper_test.go @@ -343,7 +343,7 @@ func TestBackupPodVolumes(t *testing.T) { }, uploaderType: "fake-uploader-type", errs: []string{ - "invalid uploader type 'fake-uploader-type', valid upload types are: 'restic', 'kopia'", + "invalid uploader type 'fake-uploader-type', valid type: 'kopia'", }, }, { diff --git a/pkg/uploader/types.go b/pkg/uploader/types.go index fb79f7c9f..f69cbf072 100644 --- a/pkg/uploader/types.go +++ b/pkg/uploader/types.go @@ -41,12 +41,8 @@ const ( // It will return an error if it's invalid. func ValidateUploaderType(t string) (string, error) { t = strings.TrimSpace(t) - if t != ResticType && t != KopiaType { - return "", fmt.Errorf("invalid uploader type '%s', valid upload types are: '%s', '%s'", t, ResticType, KopiaType) - } - - if t == ResticType { - return fmt.Sprintf("Uploader '%s' is deprecated, don't use it for new backups, otherwise the backups won't be available for restore when this functionality is removed in a future version of Velero", t), nil + if t != KopiaType { + return "", fmt.Errorf("invalid uploader type '%s', valid type: '%s'", t, KopiaType) } return "", nil diff --git a/pkg/uploader/types_test.go b/pkg/uploader/types_test.go index 42702931b..dcdedcd62 100644 --- a/pkg/uploader/types_test.go +++ b/pkg/uploader/types_test.go @@ -14,12 +14,6 @@ func TestValidateUploaderType(t *testing.T) { wantErr string wantMsg string }{ - { - "'restic' is a valid type", - "restic", - "", - "Uploader 'restic' is deprecated, don't use it for new backups, otherwise the backups won't be available for restore when this functionality is removed in a future version of Velero", - }, { "' kopia ' is a valid type (space will be trimmed)", " kopia ", @@ -29,7 +23,7 @@ func TestValidateUploaderType(t *testing.T) { { "'anything_else' is invalid", "anything_else", - "invalid uploader type 'anything_else', valid upload types are: 'restic', 'kopia'", + "invalid uploader type 'anything_else', valid type: 'kopia'", "", }, }