velero/pkg/restore
Bridget McErlean 0246a32ad0
Use pod namespace from backup when matching PVBs (#3475)
* Use pod namespace from backup when matching PVBs

In #3051, we introduced an additional check to ensure that a PVB matched
a particular pod by checking both the name and the namespace of the pod.
This caused an issue when using a namespace mapping on restore. In the
case where a namespace mapping is being used, the check for whether a
PVB matches a particular pod will fail as the PVB was created for the
original pod namespace and is not aware of the new namespace mapping
being used. This resulted in PVRs not being created for pods that were
being restored into new namespaces. The restic init containers were
being created to wait on the volume restore, however this would cause
the restored pods to block indefinitely as they would be waiting for a
volume restore that was not scheduled.

To fix this, we use the original namespace of the pod from the backup to
match the PVB to the pod being restored, not the new namespace where
the pod is being restored into.

Fixes #3467.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>

* Explain why the namespace mapping can't be used

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-02-22 11:16:00 -08:00
..
mocks Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
add_pv_from_pvc_action.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
add_pv_from_pvc_action_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
add_pvc_from_pod_action.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
add_pvc_from_pod_action_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
change_pvc_node_selector.go fixing 'velero.io/change-pvc-node-selector' plugin to fetch configmap using plugin name (#2970) 2020-11-04 11:45:39 -08:00
change_pvc_node_selector_test.go Fix various typos found by codespell (#3057) 2020-11-10 11:48:35 -05:00
change_storageclass_action.go k8s 1.18 import (#2651) 2020-07-16 12:21:37 -04:00
change_storageclass_action_test.go k8s 1.18 import (#2651) 2020-07-16 12:21:37 -04:00
clusterrolebinding_action.go Restore action for cluster/namespace role bindings (#1974) 2019-10-21 15:11:26 -06:00
clusterrolebinding_action_test.go Restore action for cluster/namespace role bindings (#1974) 2019-10-21 15:11:26 -06:00
crd_v1_preserve_unknown_fields_action.go bug fix: fix int/float conversion issue with CRD type in restore plugin 2020-04-30 09:06:03 -06:00
crd_v1_preserve_unknown_fields_action_test.go bug fix: fix int/float conversion issue with CRD type in restore plugin 2020-04-30 09:06:03 -06:00
init_restorehook_pod_action.go Fix typo (#3352) 2021-01-27 08:59:23 -05:00
init_restorehook_pod_action_test.go Implement restore hooks injecting init containers into pod spec (#2787) 2020-08-11 10:38:44 -07:00
job_action.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
job_action_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
merge_service_account.go update license headers to Velero contributors (#1302) 2019-03-20 12:32:48 -07:00
merge_service_account_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
pod_action.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
pod_action_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
prioritize_group_version.go Restore API group version by priority (#3133) 2021-02-16 12:36:17 -05:00
prioritize_group_version_test.go Restore API group version by priority (#3133) 2021-02-16 12:36:17 -05:00
pv_restorer.go Ensure PVs and PVCs remain bound when doing a restore (#3007) 2020-10-15 16:57:43 -07:00
pv_restorer_test.go Ensure PVs and PVCs remain bound when doing a restore (#3007) 2020-10-15 16:57:43 -07:00
restic_restore_action.go Use pod namespace from backup when matching PVBs (#3475) 2021-02-22 11:16:00 -08:00
restic_restore_action_test.go Use pod namespace from backup when matching PVBs (#3475) 2021-02-22 11:16:00 -08:00
restore.go Use pod namespace from backup when matching PVBs (#3475) 2021-02-22 11:16:00 -08:00
restore_test.go 🐛 Use namespace and name to match PVB to Pod restore (#3051) 2020-11-10 11:36:49 -05:00
result.go Restore result refactoring (#2234) 2020-02-03 10:56:57 -08:00
result_test.go Restore result refactoring (#2234) 2020-02-03 10:56:57 -08:00
rolebinding_action.go Restore action for cluster/namespace role bindings (#1974) 2019-10-21 15:11:26 -06:00
rolebinding_action_test.go Restore action for cluster/namespace role bindings (#1974) 2019-10-21 15:11:26 -06:00
service_account_action.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
service_account_action_test.go Updates for org move to vmware-tanzu (#1920) 2019-09-30 17:26:56 -04:00
service_action.go Preserve nodePort support with --preserve-nodeports flag (#3095) 2020-12-09 09:32:34 -08:00
service_action_test.go Preserve nodePort support with --preserve-nodeports flag (#3095) 2020-12-09 09:32:34 -08:00