-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle dynamic parameters which need to be changed every time before generating works for member cluster? #3436
Comments
/cc @RainbowMango |
Can this help you? |
Thanks for your reply! Currently we do not use
And still we cannot decide which cluster to put the fort pod in as issues above. |
I'm sorry, I didn't understand why you don't use |
apiVersion: policy.karmada.io/v1alpha1
kind: OverridePolicy
metadata:
annotations:
versionid: "47677"
name:
namespace:
spec:
resourceSelectors:
- apiVersion:
kind: Rollout
name:
namespace:
overrideRules:
- targetCluster:
clusterNames:
- cluster-x
overriders:
plaintext:
- path: /metadata/annotations/cdos~1az
operator: replace
value: X
- path: /spec/template/spec/containers/0/env/11
operator: replace
value:
name: CDOS_K8S_CLUSTER
value: cluster-x
- targetCluster:
clusterNames:
- cluster-z
overriders:
plaintext:
- path: /metadata/annotations/cdos~1az
operator: replace
value: Z
- path: /spec/template/spec/containers/0/env/11
operator: replace
value:
name: CDOS_K8S_CLUSTER
value: cluster-z
|
|
Thanks for your reply! Where do you think would be the appropriate place to put this piece of logic? Or, to expand the scope a bit, how could we better implement such scenarios? |
Similar problem. I'm thinking about whether we should introduce cluster info in the |
Agreed. If do so, we can implement some custom logic that need to base on cluster info. |
Do you mean you want to revise the
Does I talked to @snowplayfire yesterday about this issue. Technically, we can do that by extending the resource interpreter but seems it essentially belongs to the override area. Not sure yet, maybe we can have a chat at community meeting. |
Yes, we have implemented InterpretReplica. However, as we need the newest
Roughly correct.
My pleasure. Today we had a meeting with @snowplayfire and I've heard about this from her. And we've also communicated with @XiShanYongYe-Chang and @chaunceyjiang. Currently I think maybe both the two solutions(
Agreed. If possible, we hope to have some concrete discussions and reach some conclusions at next Tuesday's meeting. |
Does this issue meet the requirements? #1567 |
Or add pause field for PP, issue like: #517 |
Maybe this plan is more suitable for us. However, as |
@RainbowMango cops, ops, err := overrideManager.ApplyOverridePolicies(clonedWorkload, targetCluster.Name)
if err != nil {
klog.Errorf("Failed to apply overrides for %s/%s/%s, err is: %v", clonedWorkload.GetKind(), clonedWorkload.GetNamespace(), clonedWorkload.GetName(), err)
return err
}
if resourceInterpreter.HookEnabled(clonedWorkload.GroupVersionKind(), configv1alpha1.InterpreterOperationReviseObject) {
clonedWorkload, err = resourceInterpreter.ReviseObject(clonedWorkload, targetCluster.Name, int64(targetCluster.Replicas))
if err != nil {
klog.Errorf("Failed to revise object for %s/%s/%s in cluster %s, err is: %v", workload.GetKind(), workload.GetNamespace(), workload.GetName(), targetCluster.Name, err)
return err
}
} The definition of this hook is to allow users to directly modify the work. |
Ask some guys to help take a look @RainbowMango @chaunceyjiang @CharlesQQ @Poor12 |
@shiyan2016 @snowplayfire @lxtywypc |
cops, ops, err := overrideManager.ApplyOverridePolicies(clonedWorkload, targetCluster.Name)
if err != nil {
klog.Errorf("Failed to apply overrides for %s/%s/%s, err is: %v", clonedWorkload.GetKind(), clonedWorkload.GetNamespace(), clonedWorkload.GetName(), err)
return err
}
if resourceInterpreter.HookEnabled(clonedWorkload.GroupVersionKind(), configv1alpha1.InterpreterOperationReviseObject) {
clonedWorkload, err = resourceInterpreter.ReviseObject(workload, clonedWorkload, targetCluster.Name)
if err != nil {
klog.Errorf("Failed to revise object for %s/%s/%s in cluster %s, err is: %v", workload.GetKind(), workload.GetNamespace(), workload.GetName(), targetCluster.Name, err)
return err
}
} My suggestion is |
|
That's why we need to introduce |
Below is a basic scenario in our release process:
A
fort pod
means the first machine deployed in a cluster. During the bastion deployment phase, no traffic is routed to it. And in the canary deployment phase, traffic is routed to it.We've implement a
deploy CRD called Rollout
based on openkruise to handle the whole process. Part of rollout's definition for above case is as follows:So in multi-cluster case, every time user creating a release, we need to do:
canary.steps
for all member clusters.fort pod
to one of member clusters (values in steps are different between fort and non-fort clusters).For example, above rollout need to be updated in two clusters:
cluster-x
andcluster-z
. The differences between two cluster are as follows:Fort pod is allocated by below rules:
ResourceBinding
. If weights are equal, allocate it the first cluster inResourceBinding
clusters by default.Currently, we are trying to put the code in the
reviseReplicas
hook (#3375)but we encountered some issues during the develop, most related to the fort pod:
reviseReplicas
hook will not be executed.We enable users to start a release if replicas is 0, but we cannot update in this case as
reviseReplicas
hook won't be reached.cluster_name
inreviseReplicas
hook, so we cannot judge if we need to put fort pod.Usually we put the fort pod to cluster with higher weight. I the weights are evenly distributed, we decide to select the first cluster in
ResourceBinding
by default. But we can't know the cluster in this hook as it was not passed.So, is there any suitable ways to implement such differentiated configuration? And where is the appropriate place to put the code? Maybe
expanding reviseReplica by adding cluster_name and removing replicas > 0 judgement
andgiving a new hook point
?Environment:
The text was updated successfully, but these errors were encountered: