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

🌱 Ensure finalizers are resilient on reconciliation #9471

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

adityabhatia
Copy link
Contributor

@adityabhatia adityabhatia commented Sep 20, 2023

What this PR does / why we need it: Cluster API objects contain finalizers which must be resilient in the event of deletion. The deletion of finalizers can happen due to a diverse events like by mistake or system attacks. In such an event the deleted finalizers should be added back to ClusterAPI objects on reconciliation.

Which issue(s) this PR fixes:
Fixes #9434

/area e2e-testing

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 20, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: adityabhatia / name: Aditya Bhatia (5126180)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 20, 2023
@k8s-ci-robot k8s-ci-robot added the do-not-merge/needs-area PR is missing an area label label Sep 20, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @adityabhatia!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 20, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @adityabhatia. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 20, 2023
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up!

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 20, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 20, 2023
@adityabhatia adityabhatia changed the title [WIP] ensure finalizers are resilient on reconciliation [WIP] 🌱 ensure finalizers are resilient on reconciliation Sep 20, 2023
@adityabhatia adityabhatia changed the title [WIP] 🌱 ensure finalizers are resilient on reconciliation 🌱 ensure finalizers are resilient on reconciliation Sep 20, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 20, 2023
@adityabhatia adityabhatia changed the title 🌱 ensure finalizers are resilient on reconciliation 🌱 Ensure finalizers are resilient on reconciliation Sep 20, 2023
@adityabhatia
Copy link
Contributor Author

/area e2e-testing

@k8s-ci-robot k8s-ci-robot added area/e2e-testing Issues or PRs related to e2e testing and removed do-not-merge/needs-area PR is missing an area label labels Sep 20, 2023
@killianmuldoon
Copy link
Contributor

/test

@k8s-ci-robot
Copy link
Contributor

@killianmuldoon: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test pull-cluster-api-build-main
  • /test pull-cluster-api-e2e-full-dualstack-and-ipv6-main
  • /test pull-cluster-api-e2e-full-main
  • /test pull-cluster-api-e2e-main
  • /test pull-cluster-api-e2e-mink8s-main
  • /test pull-cluster-api-e2e-workload-upgrade-1-28-latest-main
  • /test pull-cluster-api-test-main
  • /test pull-cluster-api-test-mink8s-main
  • /test pull-cluster-api-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-apidiff-main
  • /test pull-cluster-api-e2e-scale-main-experimental

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-apidiff-main
  • pull-cluster-api-build-main
  • pull-cluster-api-e2e-main
  • pull-cluster-api-test-main
  • pull-cluster-api-verify-main

In response to this:

/test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@killianmuldoon
Copy link
Contributor

/test pull-cluster-api-e2e-full-main

@adityabhatia
Copy link
Contributor Author

/test pull-cluster-api-e2e-full-main

@adityabhatia adityabhatia force-pushed the addFinalizerTests branch 2 times, most recently from 89eefd1 to d40e02b Compare September 20, 2023 22:22
@chrischdi
Copy link
Member

/test pull-cluster-api-e2e-full-main

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remember to monitor these tests and merge them into the ordinary quickstart as a follow-up. That'll help reduce the overall number of tests we're running.

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits and one question:

Could this be simplified by make it more similar to the OwnerGraph test? i.e. we don't have to compare the current state to the initial state, we only have to compare the current state to a map of types -> finalizers. WDYT?

test/e2e/quick_start_test.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
@adityabhatia
Copy link
Contributor Author

Mostly nits and one question:

Could this be simplified by make it more similar to the OwnerGraph test? i.e. we don't have to compare the current state to the initial state, we only have to compare the current state to a map of types -> finalizers. WDYT?

I introduced the initialObjsWithFinalizers check to ensure that we test Finalizers not only by resource types, but also by resource names. E.g. MachineDeployment (not topology owned) will never get a Finalizer, although the MachineDeployment type is on the resource map.

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

Thanks for working on this - really good to have this in place.

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2023
cmd/clusterctl/client/cluster/ownergraph.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Outdated Show resolved Hide resolved
test/framework/finalizers_helpers.go Show resolved Hide resolved
@adityabhatia adityabhatia force-pushed the addFinalizerTests branch 4 times, most recently from f56b644 to 7d805d1 Compare October 19, 2023 19:15
@sbueringer
Copy link
Member

Sorry didn't get to it today, will review again on Monday

@sbueringer
Copy link
Member

Thank you!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 992eb26547cd1258e632db6d78d0772794b0b708

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: killianmuldoon, sbueringer

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:
  • OWNERS [killianmuldoon,sbueringer]

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

@k8s-ci-robot k8s-ci-robot merged commit ac5e546 into kubernetes-sigs:main Oct 23, 2023
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.6 milestone Oct 23, 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. area/e2e-testing Issues or PRs related to e2e testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure finalizers are re-reconciled in Cluster API
5 participants