kpt-config-sync
kpt-config-sync copied to clipboard
Add reconciler finalizer
- 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/reconcilerfinalizer 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).
[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.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/retest
/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.
/retest
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 😄
Extracted Wait refactor: https://github.com/GoogleContainerTools/kpt-config-sync/pull/252
Extracted condition optimizations to https://github.com/GoogleContainerTools/kpt-config-sync/pull/253
Extracted reconciler-manager changes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/258
Extract applier stats and status changes/fixes: https://github.com/GoogleContainerTools/kpt-config-sync/pull/259
Extracted RoleBinding deletion cleanup to https://github.com/GoogleContainerTools/kpt-config-sync/pull/319
Extracted more fake client fixes https://github.com/GoogleContainerTools/kpt-config-sync/pull/331
Extracted e2e depends-on and the objMetaFrom refactor to https://github.com/GoogleContainerTools/kpt-config-sync/pull/332
/unhold
Ready for review
[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
- ~~OWNERS~~ [nan-yu]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
