Skip to content

Commit

Permalink
set conflictResolution attribute for resources that follow dependency…
Browse files Browse the repository at this point in the history
… distribution

Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
  • Loading branch information
chaosi-zju committed Oct 24, 2024
1 parent 7347f11 commit fa27745
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/dependenciesdistributor/dependencies_distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ func (d *DependenciesDistributor) removeScheduleResultFromAttachedBindings(bindi
delete(attachedBindings[index].Labels, bindingLabelKey)
updatedSnapshot := deleteBindingFromSnapshot(bindingNamespace, bindingName, attachedBindings[index].Spec.RequiredBy)
attachedBindings[index].Spec.RequiredBy = updatedSnapshot
attachedBindings[index].Spec.ConflictResolution = ""
attachedBindings[index].Spec.PreserveResourcesOnDeletion = nil
if err := d.Client.Update(context.TODO(), attachedBindings[index]); err != nil {
klog.Errorf("Failed to update binding(%s/%s): %v", binding.Namespace, binding.Name, err)
Expand All @@ -564,6 +565,7 @@ func (d *DependenciesDistributor) createOrUpdateAttachedBinding(attachedBinding
existBinding.Spec.RequiredBy = mergeBindingSnapshot(existBinding.Spec.RequiredBy, attachedBinding.Spec.RequiredBy)
existBinding.Labels = util.DedupeAndMergeLabels(existBinding.Labels, attachedBinding.Labels)
existBinding.Spec.Resource = attachedBinding.Spec.Resource
existBinding.Spec.ConflictResolution = attachedBinding.Spec.ConflictResolution
existBinding.Spec.PreserveResourcesOnDeletion = attachedBinding.Spec.PreserveResourcesOnDeletion

if err := d.Client.Update(context.TODO(), existBinding); err != nil {
Expand Down Expand Up @@ -705,7 +707,8 @@ func buildAttachedBinding(independentBinding *workv1alpha2.ResourceBinding, obje
Name: object.GetName(),
ResourceVersion: object.GetResourceVersion(),
},
RequiredBy: result,
RequiredBy: result,
ConflictResolution: independentBinding.Spec.ConflictResolution,
PreserveResourcesOnDeletion: independentBinding.Spec.PreserveResourcesOnDeletion,
},
}
Expand Down

0 comments on commit fa27745

Please sign in to comment.