mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-29 11:32:42 +00:00
Add provision for labels and annotations in E2E tests. (#9043)
* 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:
+6
-1
@@ -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
|
||||
|
||||
@@ -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]:
|
||||
|
||||
@@ -87,6 +87,8 @@ type VeleroConfig struct {
|
||||
CloudProvider string
|
||||
ObjectStoreProvider string
|
||||
VeleroNamespace string
|
||||
PodLabels string
|
||||
ServiceAccountAnnotations string
|
||||
AdditionalBSLProvider string
|
||||
AdditionalBSLBucket string
|
||||
AdditionalBSLPrefix string
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user