@@ -30,6 +30,7 @@ import (
3030 "github.com/arangodb/kube-arangodb/pkg/debug_package/cli"
3131 "github.com/arangodb/kube-arangodb/pkg/util"
3232 "github.com/arangodb/kube-arangodb/pkg/util/errors"
33+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3334 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
3435 "github.com/arangodb/kube-arangodb/pkg/util/kclient"
3536 "github.com/arangodb/kube-arangodb/pkg/util/shutdown"
@@ -67,7 +68,11 @@ func WithKubernetesItems[T meta.Object](extract Extract[T], iterators ...Iterate
6768 })
6869
6970 for _ , item := range items {
70- if err := WithItem [T ](shutdown .Context (), logger , k , files , item , iterators ... ); err != nil {
71+ cp , ok := k8sutil .Copy (item )
72+ if ! ok {
73+ return errors .Errorf ("Unable to copy item" )
74+ }
75+ if err := WithItem [T ](shutdown .Context (), logger , k , files , cp , iterators ... ); err != nil {
7176 return err
7277 }
7378 }
@@ -80,7 +85,11 @@ func WithItem[T meta.Object](ctx context.Context, logger zerolog.Logger, client
8085 files , c := WithPrefix (files , "/%s/" , item .GetName ())
8186 defer c ()
8287 for _ , iter := range iterators {
83- if err := iter (ctx , logger , client , files , item ); err != nil {
88+ cp , ok := k8sutil .Copy (item )
89+ if ! ok {
90+ return errors .Errorf ("Unable to copy item" )
91+ }
92+ if err := iter (ctx , logger , client , files , cp ); err != nil {
8493 return err
8594 }
8695 }
0 commit comments