mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-10 23:11:03 +00:00
Merge pull request #4391 from ywk253100/211123_anno
Keep the annotation "pv.kubernetes.io/provisioned-by" when restoring PVs
This commit is contained in:
1
changelogs/unreleased/4391-ywk253100
Normal file
1
changelogs/unreleased/4391-ywk253100
Normal file
@@ -0,0 +1 @@
|
||||
Keep the annotation "pv.kubernetes.io/provisioned-by" when restoring PVs
|
||||
@@ -1563,10 +1563,6 @@ func resetVolumeBindingInfo(obj *unstructured.Unstructured) *unstructured.Unstru
|
||||
// the PV(C) controller to take the two objects and bind them again.
|
||||
delete(annotations, KubeAnnBoundByController)
|
||||
|
||||
// Remove the provisioned-by annotation which signals that the persistent
|
||||
// volume was dynamically provisioned; it is now statically provisioned.
|
||||
delete(annotations, KubeAnnDynamicallyProvisioned)
|
||||
|
||||
// GetAnnotations returns a copy, so we have to set them again.
|
||||
obj.SetAnnotations(annotations)
|
||||
|
||||
|
||||
@@ -2997,7 +2997,7 @@ func Test_resetVolumeBindingInfo(t *testing.T) {
|
||||
"resourceVersion": "1"}).Unstructured,
|
||||
expected: NewTestUnstructured().WithMetadataField("kind", "persistentVolume").
|
||||
WithName("pv-1").
|
||||
WithAnnotations().
|
||||
WithAnnotations(KubeAnnDynamicallyProvisioned).
|
||||
WithSpecField("claimRef", map[string]interface{}{
|
||||
"namespace": "ns-1", "name": "pvc-1"}).Unstructured,
|
||||
},
|
||||
@@ -3007,7 +3007,6 @@ func Test_resetVolumeBindingInfo(t *testing.T) {
|
||||
WithName("pvc-1").WithAnnotations(
|
||||
KubeAnnBindCompleted,
|
||||
KubeAnnBoundByController,
|
||||
KubeAnnDynamicallyProvisioned,
|
||||
).WithSpecField("volumeName", "pv-1").Unstructured,
|
||||
expected: NewTestUnstructured().WithMetadataField("kind", "persistentVolumeClaim").
|
||||
WithName("pvc-1").WithAnnotations().
|
||||
|
||||
Reference in New Issue
Block a user