Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#10787 from troy0820/troy0820/patch…
Browse files Browse the repository at this point in the history
…-ignore-option

🐛Check errors for IsNotFound after patching spec and status
  • Loading branch information
k8s-ci-robot authored Jul 15, 2024
2 parents afe7338 + c8ae301 commit 6f06154
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/patch/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,11 @@ func (h *Helper) Patch(ctx context.Context, obj client.Object, opts ...Option) e
if err := h.patch(ctx, obj); err != nil {
errs = append(errs, err)
}

if err := h.patchStatus(ctx, obj); err != nil {
errs = append(errs, err)
if !(apierrors.IsNotFound(err) && !obj.GetDeletionTimestamp().IsZero() && len(obj.GetFinalizers()) == 0) {
errs = append(errs, err)
}
}

if len(errs) > 0 {
Expand Down

0 comments on commit 6f06154

Please sign in to comment.