kpt-config-sync icon indicating copy to clipboard operation
kpt-config-sync copied to clipboard

Add reconciler finalizer

Open karlkfi opened this issue 3 years ago • 3 comments

  • To enable, set the RootSync/RepoSync annotation: configsync.gke.io/deletion-propagation-policy: Foreground
  • To disable, delete the annotation or use: configsync.gke.io/deletion-propagation-policy: Orphan
  • When the annotation is detected, the reconciler will add the configsync.gke.io/reconciler finalizer to the RootSync/RepoSync. The finalizer blocks deletion and triggers the reconciler to execute the kpt destroyer when the deletionTimestamp is detected. The destroyer will delete all resources managed by that reconciler.
  • To ensure the reconciler-manager doesn't conflict with the destroyer, the reconciler-manager now ignores RootSync/RepoSync updates when the deletionTimestamp is set. This doesn't affect reconciler-manager garbage collection, because that happens after deletion of the RootSync/RepoSync (OnDelete triggers on NotFound).

karlkfi avatar Oct 25 '22 21:10 karlkfi

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please ask for approval from karlkfi by writing /assign @karlkfi in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

google-oss-prow[bot] avatar Oct 25 '22 21:10 google-oss-prow[bot]

/retest

sdowell avatar Oct 26 '22 03:10 sdowell

/hold

Refactoring to use the controller-runtime framework. That should reduce the amount of code, handle retries automatically, and reduce the amount of unit tests needed.

karlkfi avatar Oct 26 '22 22:10 karlkfi

/retest

karlkfi avatar Oct 28 '22 01:10 karlkfi

I talked with @sdowell briefly on reviewing this PR. We both agreed that it would be beneficial for the reviewers if this PR can be broken down into multiple smaller ones. One suggestion from our discussion is that

  • one commit introducing the Orphan mode for scaffolding without introducing too much new functionality
  • one commit introducing the Foreground deletion mode and the deletion functions, but the functions can be placeholders with TODOs
  • implementation for the finalizer

If it is too much work to extract them as separate commits for this PR, we follow the rule of small PRs in the future 😄

nan-yu avatar Oct 28 '22 22:10 nan-yu

Extracted Wait refactor: https://github.com/GoogleContainerTools/kpt-config-sync/pull/252

karlkfi avatar Oct 28 '22 23:10 karlkfi

Extracted condition optimizations to https://github.com/GoogleContainerTools/kpt-config-sync/pull/253

karlkfi avatar Oct 29 '22 01:10 karlkfi

Extracted reconciler-manager changes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/258

karlkfi avatar Nov 02 '22 19:11 karlkfi

Extract applier stats and status changes/fixes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/259

karlkfi avatar Nov 03 '22 18:11 karlkfi

Extracted RoleBinding deletion cleanup to https://github.com/GoogleContainerTools/kpt-config-sync/pull/319

karlkfi avatar Dec 06 '22 21:12 karlkfi

Extracted more fake client fixes https://github.com/GoogleContainerTools/kpt-config-sync/pull/331

karlkfi avatar Dec 21 '22 05:12 karlkfi

Extracted e2e depends-on and the objMetaFrom refactor to https://github.com/GoogleContainerTools/kpt-config-sync/pull/332

karlkfi avatar Dec 21 '22 05:12 karlkfi

/unhold

Ready for review

karlkfi avatar Dec 21 '22 23:12 karlkfi

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nan-yu

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

google-oss-prow[bot] avatar Jan 04 '23 23:01 google-oss-prow[bot]

rocket-snail

karlkfi avatar Jan 04 '23 23:01 karlkfi