mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 14:21:18 +00:00
fix panic when processing DeleteBackupRequest objs without labels (#1556)
This fix initialises an empty map if the request object's Labels map is nil, allowing the controller to later add and modify labels on the object. Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>
This commit is contained in:
committed by
KubeKween
parent
9e7ff4e3d9
commit
d6c60b2dd5
@@ -460,8 +460,10 @@ func TestBackupDeletionControllerProcessRequest(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, td.sharedInformers.Velero().V1().VolumeSnapshotLocations().Informer().GetStore().Add(snapshotLocation))
|
||||
|
||||
// Clear out req labels to make sure the controller adds them
|
||||
td.req.Labels = make(map[string]string)
|
||||
// Clear out req labels to make sure the controller adds them and does not
|
||||
// panic when encountering a nil Labels map
|
||||
// (https://github.com/heptio/velero/issues/1546)
|
||||
td.req.Labels = nil
|
||||
|
||||
td.client.PrependReactor("get", "backups", func(action core.Action) (bool, runtime.Object, error) {
|
||||
return true, backup, nil
|
||||
|
||||
Reference in New Issue
Block a user