File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import (
18
18
"fmt"
19
19
"regexp"
20
20
21
- "github.com/pingcap/tidb-operator/pkg/apis/label"
22
21
"github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1"
23
22
"github.com/pingcap/tidb-operator/pkg/backup/constants"
24
23
"github.com/pingcap/tidb-operator/pkg/backup/util"
@@ -29,8 +28,8 @@ import (
29
28
const (
30
29
CloudAPIConcurrency = 8
31
30
PVCTagKey = "CSIVolumeName"
32
- PodTagKey = "kubernetes.io/created-for/pvc/name"
33
- PodNSTagKey = "kubernetes.io/created-for/pvc/namespace"
31
+ PvcNameTagKey = "kubernetes.io/created-for/pvc/name"
32
+ PvcNSTagKey = "kubernetes.io/created-for/pvc/namespace"
34
33
)
35
34
36
35
// AWSSnapshotter is the snapshotter for creating snapshots from volumes (during a backup)
@@ -105,8 +104,10 @@ func (s *AWSSnapshotter) AddVolumeTags(pvs []*corev1.PersistentVolume) error {
105
104
for _ , pv := range pvs {
106
105
tags := make (map [string ]string )
107
106
tags [PVCTagKey ] = pv .GetName ()
108
- tags [PodTagKey ] = pv .GetAnnotations ()[label .AnnPodNameKey ]
109
- tags [PodNSTagKey ] = pv .GetLabels ()[label .NamespaceLabelKey ]
107
+ if pv .Spec .ClaimRef != nil {
108
+ tags [PvcNameTagKey ] = pv .Spec .ClaimRef .Name
109
+ tags [PvcNSTagKey ] = pv .Spec .ClaimRef .Namespace
110
+ }
110
111
111
112
resourcesTags [pv .GetAnnotations ()[constants .AnnRestoredVolumeID ]] = tags
112
113
}
You can’t perform that action at this time.
0 commit comments