mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-04 07:07:11 +00:00
pass annotations from scheduler to created backup (#3067)
* pass annotations from scheduler to created backup Signed-off-by: Michael <michael.ketslah@tufin.com> * add change log Signed-off-by: Michael <michael.ketslah@tufin.com> * add test for annotations in controller Signed-off-by: Michael <michael.ketslah@tufin.com> * If no annotations are set - do not copy empty list Signed-off-by: Michael <michael.ketslah@tufin.com> * remove unneeded var Signed-off-by: Michael <michael.ketslah@tufin.com> * add empty annotations and actually check annotations in backups Signed-off-by: Michael <michael.ketslah@tufin.com> * add empty missing label and empty annotations Signed-off-by: Michael <michael.ketslah@tufin.com> * revert empty annotations as seems they are nil as expected Signed-off-by: Michael <michael.ketslah@tufin.com> * fix typo in changelog Signed-off-by: Michael <michael.ketslah@tufin.com> Co-authored-by: Michael <michael.ketslah@tufin.com>
This commit is contained in:
@@ -68,7 +68,7 @@ func TestCreateOptions_BuildBackupFromSchedule(t *testing.T) {
|
||||
})
|
||||
|
||||
expectedBackupSpec := builder.ForBackup("test", testNamespace).IncludedNamespaces("test").Result().Spec
|
||||
schedule := builder.ForSchedule(testNamespace, "test").Template(expectedBackupSpec).ObjectMeta(builder.WithLabels("velero.io/test", "true")).Result()
|
||||
schedule := builder.ForSchedule(testNamespace, "test").Template(expectedBackupSpec).ObjectMeta(builder.WithLabels("velero.io/test", "true"), builder.WithAnnotations("velero.io/test", "true")).Result()
|
||||
o.client.VeleroV1().Schedules(testNamespace).Create(context.TODO(), schedule, metav1.CreateOptions{})
|
||||
|
||||
t.Run("existing schedule", func(t *testing.T) {
|
||||
@@ -80,6 +80,9 @@ func TestCreateOptions_BuildBackupFromSchedule(t *testing.T) {
|
||||
"velero.io/test": "true",
|
||||
velerov1api.ScheduleNameLabel: "test",
|
||||
}, backup.GetLabels())
|
||||
assert.Equal(t, map[string]string{
|
||||
"velero.io/test": "true",
|
||||
}, backup.GetAnnotations())
|
||||
})
|
||||
|
||||
t.Run("command line labels take precedence over schedule labels", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user