Fix: deepcopy before mutating shared objects

Signed-off-by: dkeven <keven@kubesphere.io>
This commit is contained in:
dkeven
2022-01-07 18:00:26 +08:00
parent e1df8bc5bb
commit d1b0beffd6
7 changed files with 81 additions and 32 deletions

View File

@@ -123,6 +123,7 @@ func (s *persistentVolumeClaimSearcher) Search(namespace string, conditions *par
r := make([]interface{}, 0)
for _, i := range result {
i = i.DeepCopy()
inUse := s.countPods(i.Name, i.Namespace)
isSnapshotAllow := s.isSnapshotAllowed(i.GetAnnotations()["volume.beta.kubernetes.io/storage-provisioner"])
if i.Annotations == nil {