Merge pull request #3006 from Garrybest/pr_patch
avoid calling apiserver when scheduling result has no changes
This commit is contained in:
commit
7b4c541bb8
|
@ -511,6 +511,9 @@ func (s *Scheduler) patchScheduleResultForResourceBinding(oldBinding *workv1alph
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to create a merge patch: %v", err)
|
||||
}
|
||||
if "{}" == string(patchBytes) {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = s.KarmadaClient.WorkV1alpha2().ResourceBindings(newBinding.Namespace).Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
return err
|
||||
|
@ -565,6 +568,9 @@ func (s *Scheduler) patchScheduleResultForClusterResourceBinding(oldBinding *wor
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to create a merge patch: %v", err)
|
||||
}
|
||||
if "{}" == string(patchBytes) {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = s.KarmadaClient.WorkV1alpha2().ClusterResourceBindings().Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue