55 "time"
66
77 "github.com/pluralsh/console/go/client"
8- discoverycache "github.com/pluralsh/deployment-operator/pkg/cache/discovery"
9- "github.com/pluralsh/deployment-operator/pkg/common"
108 "github.com/pluralsh/polly/algorithms"
119 "github.com/pluralsh/polly/containers"
1210 "github.com/samber/lo"
@@ -16,6 +14,9 @@ import (
1614 "k8s.io/client-go/dynamic"
1715 "k8s.io/klog/v2"
1816
17+ discoverycache "github.com/pluralsh/deployment-operator/pkg/cache/discovery"
18+ "github.com/pluralsh/deployment-operator/pkg/common"
19+
1920 "github.com/pluralsh/deployment-operator/internal/helpers"
2021 "github.com/pluralsh/deployment-operator/pkg/log"
2122 smcommon "github.com/pluralsh/deployment-operator/pkg/streamline/common"
@@ -280,6 +281,11 @@ func (in *Applier) getDeleteFilterFunc(serviceID string) (func(resources []unstr
280281 return nil , err
281282 }
282283
284+ componentsSet := containers .NewSet [smcommon.Key ]()
285+ for _ , component := range components {
286+ componentsSet .Add (component .StoreKey ().VersionlessKey ())
287+ }
288+
283289 hooks , err := in .store .GetHookComponents (serviceID )
284290 if err != nil {
285291 return nil , err
@@ -328,8 +334,8 @@ func (in *Applier) getDeleteFilterFunc(serviceID string) (func(resources []unstr
328334 if ok && hook .HasDesiredState (deletePolicies ) && ! hook .HasManifestChanged (resource ) {
329335 skipApply .Add (key )
330336
331- if r , exists := keyToResource [ key ]; exists {
332- toDelete = append (toDelete , r )
337+ if componentsSet . Has ( key ) {
338+ toDelete = append (toDelete , resource )
333339 }
334340
335341 continue
0 commit comments