karmada icon indicating copy to clipboard operation
karmada copied to clipboard

when deleting labels in workload annotations, member clusters are not deleted together

Open luoMonkeyKing opened this issue 3 years ago • 10 comments

What happened: when deleting labels in workload annotations, member clusters are not deleted together,but the annotations in the work have been updated. Add and modify operations are normal.

Environment:

  • Karmada version: 1.3
  • kubectl-karmada or karmadactl version (the result of kubectl-karmada version or karmadactl version): 1.3
  • Others:

luoMonkeyKing avatar Sep 21 '22 09:09 luoMonkeyKing

Can you tell us how to reproduce it?

RainbowMango avatar Sep 21 '22 12:09 RainbowMango

when deleting labels in workload annotations, member clusters are not deleted together.

Hi, @luoMonkeyKing I guess you mean that you have deleted a field in the annotation, but the annotation in the member cluster has not been deleted.

This is expected behavior.

https://github.com/karmada-io/karmada/blob/48d9ed11a1f7b36a473a1979fe9b9dfc9cb80aca/pkg/util/objectwatcher/objectwatcher.go#L137-L139

chaunceyjiang avatar Sep 22 '22 03:09 chaunceyjiang

@RainbowMango

Create a deployment and propagate the deployment to the member cluster. The deployment's annotations are as follows:

  annotations:
    clusters: member1,member2,member3
    mapis.ictnj.io/creator: test
    aa: bbb

After the creation is successful, delete the aa: bb field of annotations in the deployment. At this time, the deployment in the member cluster will not delete this field synchronously.

luoMonkeyKing avatar Sep 22 '22 06:09 luoMonkeyKing

when deleting labels in workload annotations, member clusters are not deleted together.

Hi, @luoMonkeyKing I guess you mean that you have deleted a field in the annotation, but the annotation in the member cluster has not been deleted.

This is expected behavior.

https://github.com/karmada-io/karmada/blob/48d9ed11a1f7b36a473a1979fe9b9dfc9cb80aca/pkg/util/objectwatcher/objectwatcher.go#L137-L139

That's what you said, but what's the reason for this design? Is there any other way to delete the annotations field in karmada?

luoMonkeyKing avatar Sep 22 '22 06:09 luoMonkeyKing

but what's the reason for this design?

I don't know. Maybe @RainbowMango can answer you.

chaunceyjiang avatar Sep 22 '22 09:09 chaunceyjiang

After a resource has been applied to a member cluster, the member cluster will mutate the resource by adding some labels or annotations. That means Karmada needs to adopt the added labels/annotations.

For this case, even though you removed the label from the Karmada control plane, Karmada also gets and adopts the labels from the member cluster. Karmada can't tell if the label is added by the member cluster or removed from the Karmada control plane.

RainbowMango avatar Sep 22 '22 11:09 RainbowMango

@luoMonkeyKing Can you tell us your use case? Let's see how we can help. For now, I think the ResourceInterprefer maybe a workable solution, but it's way too complicated for this case. :(

RainbowMango avatar Sep 22 '22 11:09 RainbowMango

@luoMonkeyKing你能告诉我们你的用例吗?让我们看看如何提供帮助。 目前,我认为ResourceInterprefer可能是一个可行的解决方案,但对于这种情况来说它太复杂了。:(

Our use case is very simple, that is, the load information of the member cluster will be displayed on the page. If the annotation and the karmada control plane are inconsistent, it will cause some differences. At present, we have not added some labels or annotations to the member cluster. I want to operate completely through the karmada control surface

luoMonkeyKing avatar Sep 23 '22 01:09 luoMonkeyKing

hold for a while, let me see how to handle it. by the way, are you evaluating Karmada now or already using it in production?

RainbowMango avatar Sep 23 '22 01:09 RainbowMango

hold for a while, let me see how to handle it. by the way, are you evaluating Karmada now or already using it in production?

Ok, thank you, we are not in production yet, we are still developing on karmada

luoMonkeyKing avatar Sep 23 '22 01:09 luoMonkeyKing

I added this issue to release-1.5 backlog, and hope we can solve it in this release.

RainbowMango avatar Dec 07 '22 08:12 RainbowMango

/assign

RainbowMango avatar Dec 07 '22 08:12 RainbowMango

/unassign /assign @chaunceyjiang

Thanks @chaunceyjiang for #3099.

RainbowMango avatar Feb 02 '23 01:02 RainbowMango

@chaunceyjiang Can you summarize your ideas here or in the PR(#3099)?

RainbowMango avatar Feb 02 '23 01:02 RainbowMango