From f42406723c78bc3cc97ab0c1abe3eaa61a054ac3 Mon Sep 17 00:00:00 2001 From: Steve Kriss Date: Thu, 5 Dec 2019 13:54:19 -0700 Subject: [PATCH] bug fix: deep-copy backup's labels for snapshot tags (#2075) * bug fix: deep-copy backup's labels for snapshot tags Signed-off-by: Steve Kriss --- changelogs/unreleased/2075-skriss | 1 + pkg/backup/item_backupper.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/2075-skriss diff --git a/changelogs/unreleased/2075-skriss b/changelogs/unreleased/2075-skriss new file mode 100644 index 000000000..760281af5 --- /dev/null +++ b/changelogs/unreleased/2075-skriss @@ -0,0 +1 @@ +bug fix: deep-copy backup's labels when constructing snapshot tags, so the PV name isn't added as a label to the backup diff --git a/pkg/backup/item_backupper.go b/pkg/backup/item_backupper.go index c43d26ca0..d45fe5987 100644 --- a/pkg/backup/item_backupper.go +++ b/pkg/backup/item_backupper.go @@ -456,9 +456,10 @@ func (ib *defaultItemBackupper) takePVSnapshot(obj runtime.Unstructured, log log log = log.WithField("volumeID", volumeID) - tags := ib.backupRequest.GetLabels() - if tags == nil { - tags = map[string]string{} + // create tags from the backup's labels + tags := map[string]string{} + for k, v := range ib.backupRequest.GetLabels() { + tags[k] = v } tags["velero.io/backup"] = ib.backupRequest.Name tags["velero.io/pv"] = pv.Name