karmada icon indicating copy to clipboard operation
karmada copied to clipboard

add workload annotation propagationpolicy.karmada.io/cluster

Open CharlesQQ opened this issue 1 year ago • 10 comments

What would you like to be added: add Annotation:key=propagationpolicy.karmada.io/cluster, value is cluster name Annotation must be added before call Interperter Retain InterpreterOperation

Why is this needed: interperter webhook server need to know cluster that workload belong to

CharlesQQ avatar Dec 17 '23 14:12 CharlesQQ

+1

How about cluster.karmada.io/name: ClusterA ?

chaunceyjiang avatar Dec 17 '23 14:12 chaunceyjiang

+1

How about cluster.karmada.io/name: ClusterA ?

I have no objection about this

CharlesQQ avatar Dec 18 '23 01:12 CharlesQQ

+1 This annotation allows users to better handle resource templates when extending the resource interpreter.

XiShanYongYe-Chang avatar Dec 18 '23 02:12 XiShanYongYe-Chang

I can try to fix this issue.

/assign

chaunceyjiang avatar Dec 18 '23 03:12 chaunceyjiang

Can you mention it at tomorrow's community meeting?

XiShanYongYe-Chang avatar Dec 18 '23 03:12 XiShanYongYe-Chang

Can you mention it at tomorrow's community meeting?

sure

CharlesQQ avatar Dec 18 '23 04:12 CharlesQQ

The annotation seems to indicate a destination decision that is supposed made by the scheduler. That is concerning.

interperter webhook server need to know cluster that workload belong to

Can you explain in more detail? Why the webhook need to know cluster info?

RainbowMango avatar Dec 18 '23 09:12 RainbowMango

Why the webhook need to know cluster info?

The problem we encountered: We only need to retain the modifications of the member clusters in specific clusters, but this interface cannot distinguish which member cluster the current resource is to be distributed to.

Therefore, our current approach is to use an OP to annotation resources with the name of the cluster.

https://github.com/karmada-io/karmada/blob/adef1e59748e1e1d31cb75fffe406b5dd69a66d7/pkg/resourceinterpreter/interpreter.go#L51-L54

chaunceyjiang avatar Dec 18 '23 09:12 chaunceyjiang

Cluster information can provide more judgment basis for user-defined extension. Can we continue to promote this issue? @RainbowMango

XiShanYongYe-Chang avatar Apr 23 '24 08:04 XiShanYongYe-Chang

Cluster information can provide more judgment basis for user-defined extension. Can we continue to promote this issue? @RainbowMango

Providing the following annotation can provide users with stronger extensions

cluster.karmada.io/name: ClusterA

Alternatively, providing the target cluster name in the ctx context can also achieve the same results

func (e *atmscmInterpreter) Handle(ctx context.Context, req interpreter.Request) interpreter.Response {
   targetCluster:= ctx.Value("targetCluster").(string)
   ...
}

Or provide target cluster name in interpreter.Request

func (e *atmscmInterpreter) Handle(ctx context.Context, req interpreter.Request) interpreter.Response {
   targetCluster:= req.TargetCluster
   ...
}

weidalin avatar Apr 23 '24 12:04 weidalin