Add provision for labels and annotations in E2E tests. (#9043)
Run the E2E test on kind / build (push) Failing after 6m44s
Run the E2E test on kind / setup-test-matrix (push) Successful in 4s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 59s

* Add support for pod labels and service account annotations in Velero configuration
Signed-off-by: Priyansh Choudhary <im1706@gmail.com>

* Refactor Velero configuration to use string types for pod labels and service account annotations
Signed-off-by: Priyansh Choudhary <im1706@gmail.com>
This commit is contained in:
Priyansh Choudhary
2025-06-26 21:00:01 -04:00
committed by GitHub
parent d54d88dec9
commit bd09744b2d
5 changed files with 35 additions and 1 deletions
+6 -1
View File
@@ -104,6 +104,9 @@ REGISTRY_CREDENTIAL_FILE ?=
KIBISHII_DIRECTORY ?= github.com/vmware-tanzu-experiments/distributed-data-generator/kubernetes/yaml/
IMAGE_REGISTRY_PROXY ?=
# Parameters for labels and annotations for Velero pods and service accounts.
POD_LABELS ?=
SA_ANNOTATIONS ?=
# Flags to create an additional BSL for multiple credentials tests
ADDITIONAL_BSL_PLUGINS ?=
@@ -224,7 +227,9 @@ run-e2e: ginkgo
--kibishii-directory=$(KIBISHII_DIRECTORY) \
--disable-informer-cache=$(DISABLE_INFORMER_CACHE) \
--image-registry-proxy=$(IMAGE_REGISTRY_PROXY) \
--worker-os=$(WORKER_OS)
--worker-os=$(WORKER_OS) \
--pod-labels=$(POD_LABELS) \
--sa-annotations=$(SA_ANNOTATIONS)
.PHONY: run-perf
run-perf: ginkgo
+13
View File
@@ -362,6 +362,19 @@ func init() {
"linux",
"test k8s worker node OS version, should be either linux or windows.",
)
flag.StringVar(
&test.VeleroCfg.PodLabels,
"pod-labels",
"",
"comma-separated list of key=value labels to add to the Velero pod",
)
flag.StringVar(
&test.VeleroCfg.ServiceAccountAnnotations,
"sa-annotations",
"",
"comma-separated list of key=value annotations to add to Velero service account",
)
}
// Add label [SkipVanillaZfs]:
+2
View File
@@ -87,6 +87,8 @@ type VeleroConfig struct {
CloudProvider string
ObjectStoreProvider string
VeleroNamespace string
PodLabels string
ServiceAccountAnnotations string
AdditionalBSLProvider string
AdditionalBSLBucket string
AdditionalBSLPrefix string
+8
View File
@@ -410,6 +410,14 @@ func installVeleroServer(
args = append(args, fmt.Sprintf("--item-block-worker-count=%d", options.ItemBlockWorkerCount))
}
if len(options.PodLabels.Data()) > 0 {
args = append(args, "--pod-labels", options.PodLabels.String())
}
if len(options.ServiceAccountAnnotations.Data()) > 0 {
args = append(args, "--sa-annotations", options.ServiceAccountAnnotations.String())
}
// Only version no older than v1.15 support --backup-repository-configmap.
if options.BackupRepoConfigMap != "" &&
(semver.Compare(version, "v1.15") >= 0 || version == "main") {
+6
View File
@@ -244,6 +244,12 @@ func getProviderVeleroInstallOptions(veleroCfg *VeleroConfig,
io.VolumeSnapshotConfig = flag.NewMap()
io.VolumeSnapshotConfig.Set(veleroCfg.VSLConfig)
io.PodLabels = flag.NewMap()
io.PodLabels.Set(veleroCfg.PodLabels)
io.ServiceAccountAnnotations = flag.NewMap()
io.ServiceAccountAnnotations.Set(veleroCfg.ServiceAccountAnnotations)
io.Plugins = flag.NewStringArray(plugins...)
io.Features = veleroCfg.Features
io.DefaultVolumesToFsBackup = veleroCfg.DefaultVolumesToFsBackup