mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-07-30 20:12:42 +00:00
use Backup CR labels as tags for snapshots (#1729)
* use Backup CR labels as tags for snapshots This allows users to define custom tags to be added to snapshots, by specifying custom labels on the Backup CR with the `velero backup create --labels` flag. Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>
This commit is contained in:
committed by
KubeKween
parent
de442c1106
commit
4e1b1f9457
@@ -0,0 +1 @@
|
||||
adds the ability to define custom tags to be added to snapshots by specifying custom labels on the Backup CR with the velero backup create --labels flag
|
||||
@@ -435,10 +435,12 @@ func (ib *defaultItemBackupper) takePVSnapshot(obj runtime.Unstructured, log log
|
||||
|
||||
log = log.WithField("volumeID", volumeID)
|
||||
|
||||
tags := map[string]string{
|
||||
"velero.io/backup": ib.backupRequest.Name,
|
||||
"velero.io/pv": pv.Name,
|
||||
tags := ib.backupRequest.GetLabels()
|
||||
if tags == nil {
|
||||
tags = map[string]string{}
|
||||
}
|
||||
tags["velero.io/backup"] = ib.backupRequest.Name
|
||||
tags["velero.io/pv"] = pv.Name
|
||||
|
||||
log.Info("Getting volume information")
|
||||
volumeType, iops, err := volumeSnapshotter.GetVolumeInfo(volumeID, pvFailureDomainZone)
|
||||
|
||||
Reference in New Issue
Block a user