Skip to content

Commit 21a04ca

Browse files
committed
Handle non-existent resources explicitly
Signed-off-by: Yasin Özel <yozel@nebius.com>
1 parent d9fbaf0 commit 21a04ca

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/action/diff.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import (
4242
ssautil "github.com/fluxcd/pkg/ssa/utils"
4343

4444
v2 "github.com/fluxcd/helm-controller/api/v2"
45+
4546
"github.com/fluxcd/helm-controller/internal/diff"
4647
)
4748

@@ -297,7 +298,10 @@ func (s sortableDiffs) Less(i, j int) bool {
297298
func replaceDisallowedFieldManagers(ctx context.Context, c client.Client, fieldOwner string, disallowedFieldManagers []string, obj *unstructured.Unstructured) error {
298299
existingObj := &unstructured.Unstructured{}
299300
existingObj.SetGroupVersionKind(obj.GroupVersionKind())
300-
if err := c.Get(ctx, client.ObjectKeyFromObject(obj), existingObj); client.IgnoreNotFound(err) != nil {
301+
if err := c.Get(ctx, client.ObjectKeyFromObject(obj), existingObj); err != nil {
302+
if apierrors.IsNotFound(err) {
303+
return nil
304+
}
301305
return err
302306
}
303307

0 commit comments

Comments
 (0)