From fdca488209c0a3d23aa62e9979448dff9f71223a Mon Sep 17 00:00:00 2001 From: danfengl Date: Thu, 4 Jan 2024 02:54:30 +0000 Subject: [PATCH] Add param disable informer cache for velero installation Signed-off-by: danfengl --- test/e2e/Makefile | 5 ++++- test/e2e/e2e_suite_test.go | 1 + test/e2e/migration/migration.go | 4 ++++ test/e2e/upgrade/upgrade.go | 4 ++++ test/types.go | 2 ++ test/util/velero/install.go | 17 ++++++++++++++--- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/test/e2e/Makefile b/test/e2e/Makefile index 0271c13007..7bf80c3513 100644 --- a/test/e2e/Makefile +++ b/test/e2e/Makefile @@ -104,6 +104,7 @@ UPLOADER_TYPE ?= SNAPSHOT_MOVE_DATA ?= false DATA_MOVER_PLUGIN ?= +DISABLE_INFORMER_CACHE ?= false .PHONY:ginkgo @@ -155,7 +156,9 @@ run: ginkgo -standby-cluster-cloud-provider=$(STANDBY_CLUSTER_CLOUD_PROVIDER) \ -standby-cluster-plugins=$(STANDBY_CLUSTER_PLUGINS) \ -standby-cluster-object-store-provider=$(STANDBY_CLUSTER_OBJECT_STORE_PROVIDER) \ - -debug-velero-pod-restart=$(DEBUG_VELERO_POD_RESTART) + -debug-velero-pod-restart=$(DEBUG_VELERO_POD_RESTART) \ + -disable-informer-cache=$(DISABLE_INFORMER_CACHE) + build: ginkgo mkdir -p $(OUTPUT_DIR) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 8072c7bbeb..9464dfd100 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -94,6 +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.") } 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 2d5599c67a..6b389d4951 100644 --- a/test/e2e/migration/migration.go +++ b/test/e2e/migration/migration.go @@ -165,6 +165,10 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version) OriginVeleroCfg.VeleroImage = "" OriginVeleroCfg.RestoreHelperImage = "" 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 } 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 af8e2dc93e..9a70daae5c 100644 --- a/test/e2e/upgrade/upgrade.go +++ b/test/e2e/upgrade/upgrade.go @@ -145,6 +145,10 @@ func BackupUpgradeRestoreTest(useVolumeSnapshots bool, veleroCLI2Version VeleroC tmpCfgForOldVeleroInstall.UseRestic = !useVolumeSnapshots tmpCfgForOldVeleroInstall.UseNodeAgent = false } + //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 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 ce6ecaa1b1..ed00cada62 100644 --- a/test/types.go +++ b/test/types.go @@ -85,6 +85,8 @@ type VeleroConfig struct { StandbyClusterOjbectStoreProvider string DebugVeleroPodRestart bool IsUpgradeTest bool + WithoutDisableInformerCacheParam bool + DisableInformerCache bool } type VeleroCfgInPerf struct { diff --git a/test/util/velero/install.go b/test/util/velero/install.go index e2cbdb1ffe..42aedceb4e 100644 --- a/test/util/velero/install.go +++ b/test/util/velero/install.go @@ -50,9 +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 + RegistryCredentialFile string + RestoreHelperImage string + VeleroServerDebugMode bool + WithoutDisableInformerCacheParam bool } func VeleroInstall(ctx context.Context, veleroCfg *VeleroConfig, isStandbyCluster bool) error { @@ -130,6 +131,7 @@ func VeleroInstall(ctx context.Context, veleroCfg *VeleroConfig, isStandbyCluste veleroInstallOptions.VeleroPodCPURequest = veleroCfg.VeleroPodCPURequest veleroInstallOptions.VeleroPodMemLimit = veleroCfg.VeleroPodMemLimit veleroInstallOptions.VeleroPodMemRequest = veleroCfg.VeleroPodMemRequest + veleroInstallOptions.DisableInformerCache = veleroCfg.DisableInformerCache err = installVeleroServer(ctx, veleroCfg.VeleroCLI, veleroCfg.CloudProvider, &installOptions{ Options: veleroInstallOptions, @@ -245,6 +247,15 @@ func installVeleroServer(ctx context.Context, cli, cloudProvider string, options if len(options.Plugins) > 0 { args = append(args, "--plugins", options.Plugins.String()) } + + if !options.WithoutDisableInformerCacheParam { + if options.DisableInformerCache { + args = append(args, "--disable-informer-cache=true") + } else { + args = append(args, "--disable-informer-cache=false") + } + } + fmt.Println("Start to install Azure VolumeSnapshotClass ...") if len(options.Features) > 0 { args = append(args, "--features", options.Features)