From 8f477ba692b40e86e82d449e9cbcec34e894f904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wenkai=20Yin=28=E5=B0=B9=E6=96=87=E5=BC=80=29?= Date: Wed, 3 Jan 2024 15:47:37 +0800 Subject: [PATCH] Make informer cache disabled by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make informer cache disabled by default Fixes #7264 Signed-off-by: Wenkai Yin(尹文开) --- pkg/cmd/cli/install/install.go | 8 +++---- pkg/cmd/server/server.go | 8 +++---- pkg/controller/restore_controller.go | 26 +++++++++++----------- pkg/controller/restore_controller_test.go | 10 ++++----- pkg/install/deployment.go | 10 ++++----- pkg/install/deployment_test.go | 4 ++-- pkg/install/resources.go | 6 ++--- pkg/restore/request.go | 22 +++++++++--------- pkg/restore/restore.go | 12 +++++----- pkg/restore/restore_test.go | 22 +++++++++--------- test/e2e/Makefile | 4 ++-- test/e2e/e2e_suite_test.go | 2 +- test/e2e/migration/migration.go | 3 +-- test/e2e/upgrade/upgrade.go | 3 +-- test/types.go | 4 ++-- test/util/velero/install.go | 27 ++++++++++++----------- 16 files changed, 84 insertions(+), 87 deletions(-) diff --git a/pkg/cmd/cli/install/install.go b/pkg/cmd/cli/install/install.go index 5d2ccd28a5..75b61512a1 100644 --- a/pkg/cmd/cli/install/install.go +++ b/pkg/cmd/cli/install/install.go @@ -82,7 +82,7 @@ type Options struct { DefaultVolumesToFsBackup bool UploaderType string DefaultSnapshotMoveData bool - DisableInformerCache bool + EnableInformerCache bool ScheduleSkipImmediately bool } @@ -126,7 +126,7 @@ func (o *Options) BindFlags(flags *pflag.FlagSet) { 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.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.EnableInformerCache, "enable-informer-cache", o.EnableInformerCache, "Enable 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 (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).") } @@ -155,7 +155,7 @@ func NewInstallOptions() *Options { DefaultVolumesToFsBackup: false, UploaderType: uploader.KopiaType, DefaultSnapshotMoveData: false, - DisableInformerCache: true, + EnableInformerCache: false, ScheduleSkipImmediately: false, } } @@ -222,7 +222,7 @@ func (o *Options) AsVeleroOptions() (*install.VeleroOptions, error) { DefaultVolumesToFsBackup: o.DefaultVolumesToFsBackup, UploaderType: o.UploaderType, DefaultSnapshotMoveData: o.DefaultSnapshotMoveData, - DisableInformerCache: o.DisableInformerCache, + EnableInformerCache: o.EnableInformerCache, ScheduleSkipImmediately: o.ScheduleSkipImmediately, }, nil } diff --git a/pkg/cmd/server/server.go b/pkg/cmd/server/server.go index 8593013736..69fc986eb3 100644 --- a/pkg/cmd/server/server.go +++ b/pkg/cmd/server/server.go @@ -107,7 +107,6 @@ const ( defaultCredentialsDirectory = "/tmp/credentials" defaultMaxConcurrentK8SConnections = 30 - defaultDisableInformerCache = false ) type serverConfig struct { @@ -132,7 +131,7 @@ type serverConfig struct { uploaderType string maxConcurrentK8SConnections int defaultSnapshotMoveData bool - disableInformerCache bool + enableInformerCache bool scheduleSkipImmediately bool } @@ -163,7 +162,6 @@ func NewCommand(f client.Factory) *cobra.Command { uploaderType: uploader.ResticType, maxConcurrentK8SConnections: defaultMaxConcurrentK8SConnections, defaultSnapshotMoveData: false, - disableInformerCache: defaultDisableInformerCache, scheduleSkipImmediately: false, } ) @@ -236,7 +234,7 @@ func NewCommand(f client.Factory) *cobra.Command { command.Flags().DurationVar(&config.resourceTimeout, "resource-timeout", config.resourceTimeout, "How long to wait for resource processes which are not covered by other specific timeout parameters. Default is 10 minutes.") command.Flags().IntVar(&config.maxConcurrentK8SConnections, "max-concurrent-k8s-connections", config.maxConcurrentK8SConnections, "Max concurrent connections number that Velero can create with kube-apiserver. Default is 30.") command.Flags().BoolVar(&config.defaultSnapshotMoveData, "default-snapshot-move-data", config.defaultSnapshotMoveData, "Move data by default for all snapshots supporting data movement.") - command.Flags().BoolVar(&config.disableInformerCache, "disable-informer-cache", config.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).") + command.Flags().BoolVar(&config.enableInformerCache, "enable-informer-cache", config.enableInformerCache, "Enable 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 (disable).") command.Flags().BoolVar(&config.scheduleSkipImmediately, "schedule-skip-immediately", config.scheduleSkipImmediately, "Skip the first scheduled backup immediately after creating a schedule. Default is false (don't skip).") return command @@ -951,7 +949,7 @@ func (s *server) runControllers(defaultVolumeSnapshotLocations map[string]string s.metrics, s.config.formatFlag.Parse(), s.config.defaultItemOperationTimeout, - s.config.disableInformerCache, + s.config.enableInformerCache, ) if err = r.SetupWithManager(s.mgr); err != nil { diff --git a/pkg/controller/restore_controller.go b/pkg/controller/restore_controller.go index bacd351eb5..42da005591 100644 --- a/pkg/controller/restore_controller.go +++ b/pkg/controller/restore_controller.go @@ -103,7 +103,7 @@ type restoreReconciler struct { logFormat logging.Format clock clock.WithTickerAndDelayedExecution defaultItemOperationTimeout time.Duration - disableInformerCache bool + enableInformerCache bool newPluginManager func(logger logrus.FieldLogger) clientmgmt.Manager backupStoreGetter persistence.ObjectBackupStoreGetter @@ -126,7 +126,7 @@ func NewRestoreReconciler( metrics *metrics.ServerMetrics, logFormat logging.Format, defaultItemOperationTimeout time.Duration, - disableInformerCache bool, + enableInformerCache bool, ) *restoreReconciler { r := &restoreReconciler{ ctx: ctx, @@ -139,7 +139,7 @@ func NewRestoreReconciler( logFormat: logFormat, clock: &clock.RealClock{}, defaultItemOperationTimeout: defaultItemOperationTimeout, - disableInformerCache: disableInformerCache, + enableInformerCache: enableInformerCache, // use variables to refer to these functions so they can be // replaced with fakes for testing. @@ -540,16 +540,16 @@ func (r *restoreReconciler) runValidatedRestore(restore *api.Restore, info backu } restoreReq := &pkgrestore.Request{ - Log: restoreLog, - Restore: restore, - Backup: info.backup, - PodVolumeBackups: podVolumeBackups, - VolumeSnapshots: volumeSnapshots, - BackupReader: backupFile, - ResourceModifiers: resourceModifiers, - DisableInformerCache: r.disableInformerCache, - CSIVolumeSnapshots: csiVolumeSnapshots, - VolumeInfoMap: backupVolumeInfoMap, + Log: restoreLog, + Restore: restore, + Backup: info.backup, + PodVolumeBackups: podVolumeBackups, + VolumeSnapshots: volumeSnapshots, + BackupReader: backupFile, + ResourceModifiers: resourceModifiers, + EnableInformerCache: r.enableInformerCache, + CSIVolumeSnapshots: csiVolumeSnapshots, + VolumeInfoMap: backupVolumeInfoMap, } restoreWarnings, restoreErrors := r.restorer.RestoreWithResolvers(restoreReq, actionsResolver, pluginManager) diff --git a/pkg/controller/restore_controller_test.go b/pkg/controller/restore_controller_test.go index 5029c1d6e9..c590b1c816 100644 --- a/pkg/controller/restore_controller_test.go +++ b/pkg/controller/restore_controller_test.go @@ -115,7 +115,7 @@ func TestFetchBackupInfo(t *testing.T) { metrics.NewServerMetrics(), formatFlag, 60*time.Minute, - false, + true, ) if test.backupStoreError == nil { @@ -193,7 +193,7 @@ func TestProcessQueueItemSkips(t *testing.T) { metrics.NewServerMetrics(), formatFlag, 60*time.Minute, - false, + true, ) _, err := r.Reconcile(context.Background(), ctrl.Request{NamespacedName: types.NamespacedName{ @@ -461,7 +461,7 @@ func TestRestoreReconcile(t *testing.T) { metrics.NewServerMetrics(), formatFlag, 60*time.Minute, - false, + true, ) r.clock = clocktesting.NewFakeClock(now) @@ -639,7 +639,7 @@ func TestValidateAndCompleteWhenScheduleNameSpecified(t *testing.T) { metrics.NewServerMetrics(), formatFlag, 60*time.Minute, - false, + true, ) restore := &velerov1api.Restore{ @@ -732,7 +732,7 @@ func TestValidateAndCompleteWithResourceModifierSpecified(t *testing.T) { metrics.NewServerMetrics(), formatFlag, 60*time.Minute, - false, + true, ) restore := &velerov1api.Restore{ diff --git a/pkg/install/deployment.go b/pkg/install/deployment.go index 383b40856a..531d2a2a84 100644 --- a/pkg/install/deployment.go +++ b/pkg/install/deployment.go @@ -49,7 +49,7 @@ type podTemplateConfig struct { uploaderType string defaultSnapshotMoveData bool privilegedNodeAgent bool - disableInformerCache bool + enableInformerCache bool scheduleSkipImmediately bool } @@ -153,9 +153,9 @@ func WithDefaultSnapshotMoveData() podTemplateOption { } } -func WithDisableInformerCache() podTemplateOption { +func WithEnableInformerCache() podTemplateOption { return func(c *podTemplateConfig) { - c.disableInformerCache = true + c.enableInformerCache = true } } @@ -206,8 +206,8 @@ func Deployment(namespace string, opts ...podTemplateOption) *appsv1.Deployment args = append(args, "--default-snapshot-move-data=true") } - if c.disableInformerCache { - args = append(args, "--disable-informer-cache=true") + if c.enableInformerCache { + args = append(args, "--enable-informer-cache=true") } if c.scheduleSkipImmediately { diff --git a/pkg/install/deployment_test.go b/pkg/install/deployment_test.go index 8e9649737d..1d244e3be9 100644 --- a/pkg/install/deployment_test.go +++ b/pkg/install/deployment_test.go @@ -65,7 +65,7 @@ func TestDeployment(t *testing.T) { deploy = Deployment("velero", WithServiceAccountName("test-sa")) assert.Equal(t, "test-sa", deploy.Spec.Template.Spec.ServiceAccountName) - deploy = Deployment("velero", WithDisableInformerCache()) + deploy = Deployment("velero", WithEnableInformerCache()) assert.Len(t, deploy.Spec.Template.Spec.Containers[0].Args, 2) - assert.Equal(t, "--disable-informer-cache=true", deploy.Spec.Template.Spec.Containers[0].Args[1]) + assert.Equal(t, "--enable-informer-cache=true", deploy.Spec.Template.Spec.Containers[0].Args[1]) } diff --git a/pkg/install/resources.go b/pkg/install/resources.go index 700b7b89c6..6cc661ec7d 100644 --- a/pkg/install/resources.go +++ b/pkg/install/resources.go @@ -254,7 +254,7 @@ type VeleroOptions struct { DefaultVolumesToFsBackup bool UploaderType string DefaultSnapshotMoveData bool - DisableInformerCache bool + EnableInformerCache bool ScheduleSkipImmediately bool } @@ -362,8 +362,8 @@ func AllResources(o *VeleroOptions) *unstructured.UnstructuredList { deployOpts = append(deployOpts, WithDefaultSnapshotMoveData()) } - if o.DisableInformerCache { - deployOpts = append(deployOpts, WithDisableInformerCache()) + if o.EnableInformerCache { + deployOpts = append(deployOpts, WithEnableInformerCache()) } deploy := Deployment(o.Namespace, deployOpts...) diff --git a/pkg/restore/request.go b/pkg/restore/request.go index 5d7f6f9295..855f1e7671 100644 --- a/pkg/restore/request.go +++ b/pkg/restore/request.go @@ -53,17 +53,17 @@ func resourceKey(obj runtime.Object) string { type Request struct { *velerov1api.Restore - Log logrus.FieldLogger - Backup *velerov1api.Backup - PodVolumeBackups []*velerov1api.PodVolumeBackup - VolumeSnapshots []*volume.Snapshot - BackupReader io.Reader - RestoredItems map[itemKey]restoredItemStatus - itemOperationsList *[]*itemoperation.RestoreOperation - ResourceModifiers *resourcemodifiers.ResourceModifiers - DisableInformerCache bool - CSIVolumeSnapshots []*snapshotv1api.VolumeSnapshot - VolumeInfoMap map[string]internalVolume.VolumeInfo + Log logrus.FieldLogger + Backup *velerov1api.Backup + PodVolumeBackups []*velerov1api.PodVolumeBackup + VolumeSnapshots []*volume.Snapshot + BackupReader io.Reader + RestoredItems map[itemKey]restoredItemStatus + itemOperationsList *[]*itemoperation.RestoreOperation + ResourceModifiers *resourcemodifiers.ResourceModifiers + EnableInformerCache bool + CSIVolumeSnapshots []*snapshotv1api.VolumeSnapshot + VolumeInfoMap map[string]internalVolume.VolumeInfo } type restoredItemStatus struct { diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index e59d14be95..10ab20ffa0 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -324,7 +324,7 @@ func (kr *kubernetesRestorer) RestoreWithResolvers( kbClient: kr.kbClient, itemOperationsList: req.GetItemOperationsList(), resourceModifiers: req.ResourceModifiers, - disableInformerCache: req.DisableInformerCache, + enableInformerCache: req.EnableInformerCache, featureVerifier: kr.featureVerifier, hookTracker: hook.NewHookTracker(), volumeInfoMap: req.VolumeInfoMap, @@ -378,7 +378,7 @@ type restoreContext struct { kbClient crclient.Client itemOperationsList *[]*itemoperation.RestoreOperation resourceModifiers *resourcemodifiers.ResourceModifiers - disableInformerCache bool + enableInformerCache bool featureVerifier features.Verifier hookTracker *hook.HookTracker volumeInfoMap map[string]internalVolume.VolumeInfo @@ -446,7 +446,7 @@ func (ctx *restoreContext) execute() (results.Result, results.Result) { }() // Need to stop all informers if enabled - if !ctx.disableInformerCache { + if ctx.enableInformerCache { defer func() { // Call the cancel func to close the channel for each started informer for _, factory := range ctx.dynamicInformerFactories { @@ -578,7 +578,7 @@ func (ctx *restoreContext) execute() (results.Result, results.Result) { errs.Merge(&e) // initialize informer caches for selected resources if enabled - if !ctx.disableInformerCache { + if ctx.enableInformerCache { // CRD informer will have already been initialized if any CRDs were created, // but already-initialized informers aren't re-initialized because getGenericInformer // looks for an existing one first. @@ -1537,7 +1537,7 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso // only attempt Get before Create if using informer cache, otherwise this will slow down restore into // new namespace - if !ctx.disableInformerCache { + if ctx.enableInformerCache { ctx.log.Debugf("Checking for existence %s: %v", obj.GroupVersionKind().Kind, name) fromCluster, err = ctx.getResource(groupResource, obj, namespace, name) } @@ -1561,7 +1561,7 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso // check for the existence of the object that failed creation due to alreadyExist in cluster, if no error then it implies that object exists. // and if err then itemExists remains false as we were not able to confirm the existence of the object via Get call or creation call. // We return the get error as a warning to notify the user that the object could exist in cluster and we were not able to confirm it. - if !ctx.disableInformerCache { + if ctx.enableInformerCache { fromCluster, err = ctx.getResource(groupResource, obj, namespace, name) } else { fromCluster, err = resourceClient.Get(name, metav1.GetOptions{}) diff --git a/pkg/restore/restore_test.go b/pkg/restore/restore_test.go index 19022bb705..1ccd58f816 100644 --- a/pkg/restore/restore_test.go +++ b/pkg/restore/restore_test.go @@ -1059,7 +1059,7 @@ func TestRestoreItems(t *testing.T) { tarball io.Reader want []*test.APIResource expectedRestoreItems map[itemKey]restoredItemStatus - disableInformer bool + enableInformer bool }{ { name: "metadata uid/resourceVersion/etc. gets removed", @@ -1216,7 +1216,7 @@ func TestRestoreItems(t *testing.T) { apiResources: []*test.APIResource{ test.Secrets(builder.ForSecret("ns-1", "sa-1").Data(map[string][]byte{"foo": []byte("bar")}).Result()), }, - disableInformer: true, + enableInformer: false, want: []*test.APIResource{ test.Secrets(builder.ForSecret("ns-1", "sa-1").ObjectMeta(builder.WithLabels("velero.io/backup-name", "backup-1", "velero.io/restore-name", "restore-1")).Data(map[string][]byte{"key-1": []byte("value-1")}).Result()), }, @@ -1235,7 +1235,7 @@ func TestRestoreItems(t *testing.T) { apiResources: []*test.APIResource{ test.Secrets(builder.ForSecret("ns-1", "sa-1").Data(map[string][]byte{"foo": []byte("bar")}).Result()), }, - disableInformer: false, + enableInformer: true, want: []*test.APIResource{ test.Secrets(builder.ForSecret("ns-1", "sa-1").ObjectMeta(builder.WithLabels("velero.io/backup-name", "backup-1", "velero.io/restore-name", "restore-1")).Data(map[string][]byte{"key-1": []byte("value-1")}).Result()), }, @@ -1394,14 +1394,14 @@ func TestRestoreItems(t *testing.T) { } data := &Request{ - Log: h.log, - Restore: tc.restore, - Backup: tc.backup, - PodVolumeBackups: nil, - VolumeSnapshots: nil, - BackupReader: tc.tarball, - RestoredItems: map[itemKey]restoredItemStatus{}, - DisableInformerCache: tc.disableInformer, + Log: h.log, + Restore: tc.restore, + Backup: tc.backup, + PodVolumeBackups: nil, + VolumeSnapshots: nil, + BackupReader: tc.tarball, + RestoredItems: map[itemKey]restoredItemStatus{}, + EnableInformerCache: tc.enableInformer, } warnings, errs := h.restorer.Restore( data, diff --git a/test/e2e/Makefile b/test/e2e/Makefile index 7bf80c3513..7da9a91174 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -104,7 +104,7 @@ UPLOADER_TYPE ?= SNAPSHOT_MOVE_DATA ?= false DATA_MOVER_PLUGIN ?= -DISABLE_INFORMER_CACHE ?= false +ENABLE_INFORMER_CACHE ?= true .PHONY:ginkgo @@ -157,7 +157,7 @@ run: ginkgo -standby-cluster-plugins=$(STANDBY_CLUSTER_PLUGINS) \ -standby-cluster-object-store-provider=$(STANDBY_CLUSTER_OBJECT_STORE_PROVIDER) \ -debug-velero-pod-restart=$(DEBUG_VELERO_POD_RESTART) \ - -disable-informer-cache=$(DISABLE_INFORMER_CACHE) + -enable-informer-cache=$(ENABLE_INFORMER_CACHE) build: ginkgo diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 9464dfd100..c03cd09013 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -94,7 +94,7 @@ func init() { flag.StringVar(&VeleroCfg.StandbyClusterPlugins, "standby-cluster-plugins", "", "plugins provider for standby cluster.") flag.StringVar(&VeleroCfg.StandbyClusterOjbectStoreProvider, "standby-cluster-object-store-provider", "", "object store provider for standby cluster.") flag.BoolVar(&VeleroCfg.DebugVeleroPodRestart, "debug-velero-pod-restart", false, "a switch for debugging velero pod restart.") - flag.BoolVar(&VeleroCfg.DisableInformerCache, "disable-informer-cache", false, "a switch for disable informer cache.") + flag.BoolVar(&VeleroCfg.EnableInformerCache, "enable-informer-cache", true, "a switch for enable informer cache.") } var _ = Describe("[APIGroup][APIVersion] Velero tests with various CRD API group versions", APIGropuVersionsTest) diff --git a/test/e2e/migration/migration.go b/test/e2e/migration/migration.go index 6b389d4951..5624781d13 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -167,8 +167,7 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version) OriginVeleroCfg.Plugins = "" //TODO: Remove this setting when migration path is from 1.13 to higher version //TODO: or self, because version 1.12 and older versions have no this parameter. - OriginVeleroCfg.WithoutDisableInformerCacheParam = true - OriginVeleroCfg.DisableInformerCache = false + OriginVeleroCfg.WithoutEnableInformerCacheParam = true } Expect(VeleroInstall(context.Background(), &OriginVeleroCfg, false)).To(Succeed()) if veleroCLI2Version.VeleroVersion != "self" { diff --git a/test/e2e/upgrade/upgrade.go b/test/e2e/upgrade/upgrade.go index 9a70daae5c..1f674e0499 100644 --- a/test/e2e/upgrade/upgrade.go +++ b/test/e2e/upgrade/upgrade.go @@ -147,8 +147,7 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, veleroCLI2Version VeleroC } //TODO: Remove this setting when upgrade path is from 1.13 to higher //TODO: version, or self version 1.12 and older versions have no this parameter. - tmpCfgForOldVeleroInstall.WithoutDisableInformerCacheParam = true - tmpCfgForOldVeleroInstall.DisableInformerCache = false + tmpCfgForOldVeleroInstall.WithoutEnableInformerCacheParam = true Expect(VeleroInstall(context.Background(), &tmpCfgForOldVeleroInstall, false)).To(Succeed()) Expect(CheckVeleroVersion(context.Background(), tmpCfgForOldVeleroInstall.VeleroCLI, diff --git a/test/types.go b/test/types.go index ed00cada62..f4c4180e4f 100644 --- a/test/types.go +++ b/test/types.go @@ -85,8 +85,8 @@ type VeleroConfig struct { StandbyClusterOjbectStoreProvider string DebugVeleroPodRestart bool IsUpgradeTest bool - WithoutDisableInformerCacheParam bool - DisableInformerCache bool + WithoutEnableInformerCacheParam bool + EnableInformerCache bool } type VeleroCfgInPerf struct { diff --git a/test/util/velero/install.go b/test/util/velero/install.go index 42aedceb4e..192ff50ebd 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -50,10 +50,10 @@ const ( // we provide more install options other than the standard install.InstallOptions in E2E test type installOptions struct { *install.Options - RegistryCredentialFile string - RestoreHelperImage string - VeleroServerDebugMode bool - WithoutDisableInformerCacheParam bool + RegistryCredentialFile string + RestoreHelperImage string + VeleroServerDebugMode bool + WithoutEnableInformerCacheParam bool } func VeleroInstall(ctx context.Context, veleroCfg *VeleroConfig, isStandbyCluster bool) error { @@ -131,13 +131,14 @@ func VeleroInstall(ctx context.Context, veleroCfg *VeleroConfig, isStandbyCluste veleroInstallOptions.VeleroPodCPURequest = veleroCfg.VeleroPodCPURequest veleroInstallOptions.VeleroPodMemLimit = veleroCfg.VeleroPodMemLimit veleroInstallOptions.VeleroPodMemRequest = veleroCfg.VeleroPodMemRequest - veleroInstallOptions.DisableInformerCache = veleroCfg.DisableInformerCache + veleroInstallOptions.EnableInformerCache = veleroCfg.EnableInformerCache err = installVeleroServer(ctx, veleroCfg.VeleroCLI, veleroCfg.CloudProvider, &installOptions{ - Options: veleroInstallOptions, - RegistryCredentialFile: veleroCfg.RegistryCredentialFile, - RestoreHelperImage: veleroCfg.RestoreHelperImage, - VeleroServerDebugMode: veleroCfg.VeleroServerDebugMode, + Options: veleroInstallOptions, + RegistryCredentialFile: veleroCfg.RegistryCredentialFile, + RestoreHelperImage: veleroCfg.RestoreHelperImage, + VeleroServerDebugMode: veleroCfg.VeleroServerDebugMode, + WithoutEnableInformerCacheParam: veleroCfg.WithoutEnableInformerCacheParam, }) if err != nil { @@ -248,11 +249,11 @@ func installVeleroServer(ctx context.Context, cli, cloudProvider string, options args = append(args, "--plugins", options.Plugins.String()) } - if !options.WithoutDisableInformerCacheParam { - if options.DisableInformerCache { - args = append(args, "--disable-informer-cache=true") + if !options.WithoutEnableInformerCacheParam { + if options.EnableInformerCache { + args = append(args, "--enable-informer-cache=true") } else { - args = append(args, "--disable-informer-cache=false") + args = append(args, "--enable-informer-cache=false") } }