diff --git a/pkg/kube/fake/fake.go b/pkg/kube/fake/fake.go index ceca3c113..0af4b1685 100644 --- a/pkg/kube/fake/fake.go +++ b/pkg/kube/fake/fake.go @@ -45,6 +45,10 @@ type FailingKubeClient struct { BuildDummy bool BuildUnstructuredError error WaitDuration time.Duration + // ExistingResources represents resources that already exist in the cluster + ExistingResources []*resource.Info + // ResourcesAdopted tracks how many resources were adopted + ResourcesAdopted int } // Create returns the configured error if set or prints @@ -120,6 +124,12 @@ func (f *FailingKubeClient) Build(r io.Reader, _ bool) (kube.ResourceList, error if f.BuildDummy { return createDummyResourceList(), nil } + // If we have existing resources, return them + if len(f.ExistingResources) > 0 { + // Track that resources were adopted + f.ResourcesAdopted++ + return f.ExistingResources, nil + } return f.PrintingKubeClient.Build(r, false) }