From e0a940cab00947e7dc18702ac6c00dddc4492903 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Fri, 6 Jan 2023 10:56:02 +0800 Subject: [PATCH] clear the comments for deleting unmanaged appliedmanifestworks (#174) Signed-off-by: Wei Liu Signed-off-by: Wei Liu --- .../unmanaged_appliedmanifestwork_controller.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/spoke/controllers/finalizercontroller/unmanaged_appliedmanifestwork_controller.go b/pkg/spoke/controllers/finalizercontroller/unmanaged_appliedmanifestwork_controller.go index 49bcc13f3..a28330cb8 100644 --- a/pkg/spoke/controllers/finalizercontroller/unmanaged_appliedmanifestwork_controller.go +++ b/pkg/spoke/controllers/finalizercontroller/unmanaged_appliedmanifestwork_controller.go @@ -83,10 +83,9 @@ func (m *UnManagedAppliedWorkController) sync(ctx context.Context, controllerCon return err } - // We delete the old applied work until the work of this applied work is applied. - // This will avoid to delete the old applied work prematurely, if an applied work is an - // owner of its applied resource, if we delete the old applied work prematurely, this will - // casue to delete the applied resource. + // We delete the old AppliedManifestWork only when the related ManifestWork is applied with the new + // AppliedManifestWork as the new owner. This can avoid deleting the old AppliedManifestWork prematurely + // before the new AppliedManifestWork takes the ownership of the applied resources. manifestWork, err := m.manifestWorkLister.Get(appliedManifestWork.Spec.ManifestWorkName) if errors.IsNotFound(err) { // work not found, could have been deleted, do nothing.