fix a bug that Replica set by overridepolicy will be reset by ReviseReplica interpreterhook issue#1347
Signed-off-by: likakuli <1154584512@qq.com>
This commit is contained in:
parent
ca2997293f
commit
f4fc8ee15b
|
@ -81,11 +81,6 @@ func ensureWork(
|
||||||
for i := range targetClusters {
|
for i := range targetClusters {
|
||||||
targetCluster := targetClusters[i]
|
targetCluster := targetClusters[i]
|
||||||
clonedWorkload := workload.DeepCopy()
|
clonedWorkload := workload.DeepCopy()
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
workNamespace, err := names.GenerateExecutionSpaceName(targetCluster.Name)
|
workNamespace, err := names.GenerateExecutionSpaceName(targetCluster.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -116,6 +111,13 @@ func ensureWork(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We should call ApplyOverridePolicies last, as override rules have the highest priority
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
annotations := mergeAnnotations(clonedWorkload, binding, scope)
|
annotations := mergeAnnotations(clonedWorkload, binding, scope)
|
||||||
annotations, err = recordAppliedOverrides(cops, ops, annotations)
|
annotations, err = recordAppliedOverrides(cops, ops, annotations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue