Skip to content

Conversation

@0xavi0
Copy link
Contributor

@0xavi0 0xavi0 commented Nov 24, 2025

This PR introduces changes to how GitRepos are deleted, as well as their dependent resources.

Two main changes are introduced:

  • The function that deletes the GitRepo has been modified to check for any pending resources, especially Bundles and ImageScans, since previously the GitRepo was removed before these resources were fully deleted.

  • A new controller is introduced for Content resources to track the number of BundleDeployments that reference the same one. This controller aims to eliminate the conflicts that occurred when updating or deleting BundleDeployments, as they were being updated or removed concurrently while modifying a shared Content resource.

With these changes, the goal is to eliminate both update conflicts (which triggered additional Reconcile calls in the controllers) and potential race conditions when deleting and recreating GitRepos that still had dependent resources pending deletion.

Refers to #4192
Refers to #4251

Additional Information

Checklist

- [ ] I have updated the documentation via a pull request in the
fleet-docs repository.

@0xavi0 0xavi0 self-assigned this Nov 24, 2025
@0xavi0 0xavi0 force-pushed the 4192-gitrepo-delete-cascade branch from a24d029 to fcc8657 Compare November 24, 2025 11:33
This PR introduces changes to how GitRepos are deleted, as well as their dependent resources.

Two main changes are introduced:

* The function that deletes the GitRepo has been modified to check for any pending resources, especially *Bundles* and *ImageScans*, since previously the *GitRepo* was removed before these resources were fully deleted.

* A new controller is introduced for *Content* resources to track the number of *BundleDeployments* that reference the same one.
  This controller aims to eliminate the conflicts that occurred when updating or deleting *BundleDeployments*, as they were being updated or removed concurrently while modifying a shared *Content* resource.

With these changes, the goal is to eliminate both update conflicts (which triggered additional Reconcile calls in the controllers) and potential race conditions when deleting and recreating *GitRepos* that still had dependent resources pending deletion.

Signed-off-by: Xavi Garcia <[email protected]>
@0xavi0 0xavi0 force-pushed the 4192-gitrepo-delete-cascade branch from fcc8657 to f59b831 Compare November 24, 2025 12:43
@0xavi0 0xavi0 added this to Fleet Nov 24, 2025
@0xavi0 0xavi0 added this to the v2.13.1 milestone Nov 24, 2025
@0xavi0 0xavi0 marked this pull request as ready for review November 24, 2025 13:09
@0xavi0 0xavi0 requested a review from a team as a code owner November 24, 2025 13:09
@0xavi0 0xavi0 moved this to Needs QA review in Fleet Nov 25, 2025
@0xavi0 0xavi0 moved this from Needs QA review to 👀 In review in Fleet Nov 25, 2025
Copy link
Contributor

@weyfonk weyfonk left a comment

Choose a reason for hiding this comment

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

This feels cleaner than the previous approach, if slightly more "manual".
Finalizers were not the right tool for the job, it seems :)

bd.Spec.ValuesHash = valuesHash

// When content resources are stored in etcd, we need to keep track of the content resource so they
// are properly gargabe collected by the content controller.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
// are properly gargabe collected by the content controller.
// are properly garbage-collected by the content controller.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can still see this typo ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've searched at the whole project and I can't find it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It still says "gargabe" instead of "garbage".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix in a future PR, sorry for the confusion

@0xavi0 0xavi0 force-pushed the 4192-gitrepo-delete-cascade branch from 64317ed to d46f405 Compare November 28, 2025 09:21
Signed-off-by: Xavi Garcia <[email protected]>
@0xavi0 0xavi0 force-pushed the 4192-gitrepo-delete-cascade branch from d46f405 to d0d4dc6 Compare November 28, 2025 09:30
@0xavi0 0xavi0 requested a review from weyfonk November 28, 2025 10:30
Signed-off-by: Xavi Garcia <[email protected]>
@0xavi0 0xavi0 requested a review from weyfonk November 28, 2025 15:07
@0xavi0 0xavi0 merged commit 35e9735 into rancher:main Nov 28, 2025
35 of 36 checks passed
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Fleet Nov 28, 2025
0xavi0 added a commit to 0xavi0/fleet that referenced this pull request Dec 1, 2025
* Change GitRepo deletion.

This PR introduces changes to how GitRepos are deleted, as well as their dependent resources.

Two main changes are introduced:

* The function that deletes the GitRepo has been modified to check for any pending resources, especially *Bundles* and *ImageScans*, since previously the *GitRepo* was removed before these resources were fully deleted.

* A new controller is introduced for *Content* resources to track the number of *BundleDeployments* that reference the same one.
  This controller aims to eliminate the conflicts that occurred when updating or deleting *BundleDeployments*, as they were being updated or removed concurrently while modifying a shared *Content* resource.

With these changes, the goal is to eliminate both update conflicts (which triggered additional Reconcile calls in the controllers) and potential race conditions when deleting and recreating *GitRepos* that still had dependent resources pending deletion.

---------

Signed-off-by: Xavi Garcia <[email protected]>
@0xavi0 0xavi0 modified the milestones: v2.13.1, v2.14.0 Dec 1, 2025
thardeck pushed a commit that referenced this pull request Dec 1, 2025
* Change GitRepo deletion.

This PR introduces changes to how GitRepos are deleted, as well as their dependent resources.

Two main changes are introduced:

* The function that deletes the GitRepo has been modified to check for any pending resources, especially *Bundles* and *ImageScans*, since previously the *GitRepo* was removed before these resources were fully deleted.

* A new controller is introduced for *Content* resources to track the number of *BundleDeployments* that reference the same one.
  This controller aims to eliminate the conflicts that occurred when updating or deleting *BundleDeployments*, as they were being updated or removed concurrently while modifying a shared *Content* resource.

With these changes, the goal is to eliminate both update conflicts (which triggered additional Reconcile calls in the controllers) and potential race conditions when deleting and recreating *GitRepos* that still had dependent resources pending deletion.

---------

Signed-off-by: Xavi Garcia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants