Skip to content

Conversation

@britaniar
Copy link
Collaborator

@britaniar britaniar commented May 8, 2025

Description of your changes

Fixes #

I have:

  • now track work that is deleting by using Foreground deletion mode on applied work

  • update the owner reference to not block applied work deletion when there is co-ownership.

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

References:

@codecov
Copy link

codecov bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 71.59091% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/controllers/workapplier/controller.go 66.66% 21 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@britaniar britaniar marked this pull request as ready for review May 8, 2025 20:52
@michaelawyu
Copy link
Collaborator

Hi Britania! A side note: though the case we troubleshot was quite special, we probably still need to handle it as a corner case to avoid system being stuck forever -> it could be sent in a separate PR though.

@michaelawyu
Copy link
Collaborator

Added some comments, PTAL.

@britaniar britaniar force-pushed the deletedWork branch 4 times, most recently from 6bc8746 to 82bd3ad Compare June 5, 2025 23:36
@britaniar britaniar changed the title feat: track work deletion feat: Change AppliedWork to used foregroundDeletion Jun 10, 2025
@britaniar britaniar force-pushed the deletedWork branch 3 times, most recently from 8332560 to 10311a3 Compare June 16, 2025 18:30
@britaniar britaniar requested a review from Copilot June 17, 2025 16:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the deletion mechanism for applied work by switching to foreground deletion and adjusting owner reference behavior accordingly. Key changes include updating tests to verify work resource deletion, modifying BlockOwnerDeletion settings in owner references, and changing the deletion propagation policy in garbage collection.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/e2e/utils_test.go Added waiting for work resource deletion and reset ResourceVersion in tests
test/e2e/placement_pickfixed_test.go Added scenarios to simulate stuck deletions and verify proper finalizer management
test/e2e/placement_apply_strategy_test.go Replaced inline owner reference definitions with a reusable variable and improved error messages
test/e2e/enveloped_object_placement_test.go Minor adjustment to delete a second envelope resource
pkg/controllers/workapplier/preprocess.go Removed unused import and updated owner reference equality checks in removal logic
pkg/controllers/workapplier/controller_test.go Added tests for ClusterRole resources
pkg/controllers/workapplier/controller.go Changed deletion propagation to foreground and updated owner reference settings

…reference when co-ownership is allowed

Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
@britaniar britaniar force-pushed the deletedWork branch 2 times, most recently from dca21c5 to c0c3243 Compare June 17, 2025 19:57
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Copy link
Collaborator

@michaelawyu michaelawyu left a comment

Choose a reason for hiding this comment

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

Added some comments, PTAL. Let me know if you'd like to discuss it a bit further.

UID: appliedWork.UID,
}

for _, res := range appliedWork.Status.AppliedResources {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Britania! This part might have some potential consistency issues; the AppliedResources on AppliedWork objects are updated only at the end of the reconciliation loop on a best effort basis; it might not incude all the applied manifests if, say, the status update is skipped/interruptted. The work object status is, instead, designed to be always consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we make appliedResources accurate? I thought we rely on this to remove resources from the member cluster

UID: appliedWork.UID,
}

for _, res := range appliedWork.Status.AppliedResources {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make appliedResources accurate? I thought we rely on this to remove resources from the member cluster

Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
@ryanzhang-oss ryanzhang-oss merged commit dcd82cb into kubefleet-dev:main Jun 27, 2025
19 of 21 checks passed
@britaniar britaniar deleted the deletedWork branch June 27, 2025 17:25
britaniar added a commit to britaniar/kubefleet that referenced this pull request Jun 28, 2025
Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
audrastump pushed a commit to audrastump/kubefleet that referenced this pull request Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants