Skip to content

Commit

Permalink
binding.status.schedulerObservedGeneration and generation are inconsi…
Browse files Browse the repository at this point in the history
…stent

Signed-off-by: Poor12 <shentiecheng@huawei.com>
  • Loading branch information
Poor12 committed Apr 26, 2023
1 parent 48e93dc commit 3b80fe3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,13 @@ func (s *Scheduler) patchScheduleResultForResourceBinding(oldBinding *workv1alph
return nil
}

_, err = s.KarmadaClient.WorkV1alpha2().ResourceBindings(newBinding.Namespace).Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
result, err := s.KarmadaClient.WorkV1alpha2().ResourceBindings(newBinding.Namespace).Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
if err != nil {
klog.Errorf("Failed to patch schedule to ResourceBinding(%s/%s): %v", oldBinding.Namespace, oldBinding.Name, err)
return err
}

*oldBinding = *result
klog.V(4).Infof("Patch schedule to ResourceBinding(%s/%s) succeed", oldBinding.Namespace, oldBinding.Name)
return nil
}
Expand Down Expand Up @@ -648,8 +650,15 @@ func (s *Scheduler) patchScheduleResultForClusterResourceBinding(oldBinding *wor
return nil
}

_, err = s.KarmadaClient.WorkV1alpha2().ClusterResourceBindings().Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
return err
result, err := s.KarmadaClient.WorkV1alpha2().ClusterResourceBindings().Patch(context.TODO(), newBinding.Name, types.MergePatchType, patchBytes, metav1.PatchOptions{})
if err != nil {
klog.Errorf("Failed to patch schedule to ClusterResourceBinding(%s): %v", oldBinding.Name, err)
return err
}

*oldBinding = *result
klog.V(4).Infof("Patch schedule to ClusterResourceBinding(%s) succeed", oldBinding.Name)
return nil
}

func (s *Scheduler) handleErr(err error, key interface{}) {
Expand Down

0 comments on commit 3b80fe3

Please sign in to comment.