Skip to content

Commit

Permalink
Merge pull request #7277 from danfengliu/add-disable-informer-cache-p…
Browse files Browse the repository at this point in the history
…aram

Add test for disable informer cache param of velero installation
  • Loading branch information
danfengliu authored Jan 5, 2024
2 parents 3401db4 + fdca488 commit c2177c2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
5 changes: 4 additions & 1 deletion test/e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ UPLOADER_TYPE ?=

SNAPSHOT_MOVE_DATA ?= false
DATA_MOVER_PLUGIN ?=
DISABLE_INFORMER_CACHE ?= false


.PHONY:ginkgo
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions test/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ type VeleroConfig struct {
StandbyClusterOjbectStoreProvider string
DebugVeleroPodRestart bool
IsUpgradeTest bool
WithoutDisableInformerCacheParam bool
DisableInformerCache bool
}

type VeleroCfgInPerf struct {
Expand Down
17 changes: 14 additions & 3 deletions test/util/velero/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c2177c2

Please sign in to comment.