Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Use Update to set finalizers in reconciler #2838

Closed
wants to merge 2 commits into from

Conversation

pierDipi
Copy link
Member

Using patch to set finalizers might lead to having reconciled
resources that are never finalized since PATCH doesn't have
any optimistic concurrency controls [1] so we might reconciling
a resource that has been deleted after being fetched from the
API Server.

[1] https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/

Changes

  • Use Update to set finalizers in reconciler

/kind bug

Fixes #2828

Release Note

Use UPDATE to set finalizers in reconciler since using PATCH to set finalizers might lead to having reconciled resources that are never finalized.

Docs


Using patch to set finalizers might lead to having reconciled
resources that are never finalized since `PATCH` doesn't have
any optimistic concurrency controls [1].

[1] https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
@knative-prow knative-prow bot added kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 25, 2023
@pierDipi pierDipi changed the title Use Update to set finalizers in reconciler [WIP] Use Update to set finalizers in reconciler Sep 25, 2023
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 25, 2023
@knative-prow
Copy link

knative-prow bot commented Sep 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pierDipi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2023
@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.04% ⚠️

Comparison is base (51a826d) 81.86% compared to head (a9424f0) 81.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2838      +/-   ##
==========================================
- Coverage   81.86%   81.82%   -0.04%     
==========================================
  Files         167      167              
  Lines       10224    10224              
==========================================
- Hits         8370     8366       -4     
- Misses       1608     1612       +4     
  Partials      246      246              

see 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
@Cali0707
Copy link
Member

@pierDipi I'm curious, why does Update prevent the race condition caused by Patch?

@pierDipi pierDipi closed this Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using patch to set finalizers might lead to having reconciled resources that are never finalized
2 participants