karmada icon indicating copy to clipboard operation
karmada copied to clipboard

`ResourceInterpreterCustomization` for `Prune`

Open a7i opened this issue 1 year ago • 7 comments

What would you like to be added: Currently, Prune is only supported for built-in, and there are use-cases where we could use Prune for custom resources.

Why is this needed: this blog does a good job of covering the interpreters and based on the image, we may want to exclude labels/annotations before Work is created image

a7i avatar May 15 '24 22:05 a7i

@a7i Thanks for your feedback, I think this is an interesting feature point.

Before we start discussing how to do this, let's invite some ideas from people who might be interested in this.

/cc @chaunceyjiang @whitewindmills @RainbowMango @yike21 @iawia002

XiShanYongYe-Chang avatar May 16 '24 03:05 XiShanYongYe-Chang

we may want to exclude labels/annotations before Work is created

Hi @a7i I'd like to know under what circumstances this would be necessary. Because after communicating with @RainbowMango, I realized that retain can be used to handle the conflict between the Karmada control plane and member clusters.

XiShanYongYe-Chang avatar May 16 '24 09:05 XiShanYongYe-Chang

Prune would be to strip certain fields (e.g. label) from being propagated. With Retain, the label still goes to the member cluster but the value is essentially ignored.

One use-case is that we use a label to determine if a workload should be duplicated in all member clusters or not (the label is matched by the policy labelSelector). There is no need for this label to get propagated to the member clusters.

a7i avatar May 16 '24 17:05 a7i

Thanks for the use case. I think it makes sense. cc @RainbowMango

XiShanYongYe-Chang avatar May 17 '24 01:05 XiShanYongYe-Chang

It seems to make sense, I'll get back to it later.

RainbowMango avatar May 17 '24 01:05 RainbowMango

One use-case is that we use a label to determine if a workload should be duplicated in all member clusters or not (the label is matched by the policy labelSelector). There is no need for this label to get propagated to the member clusters.

make sense.

whitewindmills avatar May 20 '24 01:05 whitewindmills

One use-case is that we use a label to determine if a workload should be duplicated in all member clusters or not (the label is matched by the policy labelSelector). There is no need for this label to get propagated to the member clusters.

It seems a reasonable use case that you label resources and let PropagationPolicy match them. But I have several questions:

  1. I know there is no need for this label to get propagated, but that doesn't do any harm, right?
  2. Can we prune the unnecessary label by OverridePolicy? I'm wondering if this is an option.

RainbowMango avatar May 20 '24 08:05 RainbowMango

🤔 It seems that using OverridePolicy can cove this.

chaunceyjiang avatar May 28 '24 02:05 chaunceyjiang

Using Lua gives more flexibility and control than PlaintextOverrider but at the moment, using a ClusterOverridePolicy will work for us. Thank you

/close

a7i avatar May 28 '24 04:05 a7i

@a7i: Closing this issue.

In response to this:

Using Lua gives more flexibility and control than PlaintextOverrider but at the moment, using a ClusterOverridePolicy will work for us. Thank you

/close

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-sigs/prow repository.

karmada-bot avatar May 28 '24 04:05 karmada-bot

Oh, seems you like Lua.

But, by the way, the LabelAnnotationOverrider and LabelAnnotationOverrider might be more straightforward than PlaintextOverrider.

RainbowMango avatar May 28 '24 07:05 RainbowMango

It's growing on me :)

a7i avatar May 28 '24 09:05 a7i