Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#585 from k82cn/update_pod_cond
Browse files Browse the repository at this point in the history
Removed invalid error log.
  • Loading branch information
k8s-ci-robot authored Feb 11, 2019
2 parents 9b9fc70 + c3a53ba commit 5a70bf2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/scheduler/actions/allocate/allocate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (fb *fakeBinder) Bind(p *v1.Pod, hostname string) error {
type fakeStatusUpdater struct {
}

func (ftsu *fakeStatusUpdater) UpdatePod(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error) {
func (ftsu *fakeStatusUpdater) UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error) {
// do nothing here
return nil, nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ type defaultStatusUpdater struct {
}

// Update pod with podCondition
func (su *defaultStatusUpdater) UpdatePod(pod *v1.Pod, condition *v1.PodCondition) (*v1.Pod, error) {
func (su *defaultStatusUpdater) UpdatePodCondition(pod *v1.Pod, condition *v1.PodCondition) (*v1.Pod, error) {
glog.V(3).Infof("Updating pod condition for %s/%s to (%s==%s)", pod.Namespace, pod.Name, condition.Type, condition.Status)
if podutil.UpdatePodCondition(&pod.Status, condition) {
return su.kubeclient.CoreV1().Pods(pod.Namespace).UpdateStatus(pod)
}
return nil, fmt.Errorf("failed to update pod condition")
return pod, nil
}

// Update pod with podCondition
Expand Down Expand Up @@ -439,7 +439,7 @@ func (sc *SchedulerCache) taskUnschedulable(task *api.TaskInfo, message string)
pod := task.Pod.DeepCopy()

sc.Recorder.Eventf(pod, v1.EventTypeWarning, string(v1.PodReasonUnschedulable), message)
if _, err := sc.StatusUpdater.UpdatePod(pod, &v1.PodCondition{
if _, err := sc.StatusUpdater.UpdatePodCondition(pod, &v1.PodCondition{
Type: v1.PodScheduled,
Status: v1.ConditionFalse,
Reason: v1.PodReasonUnschedulable,
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/cache/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ type Evictor interface {

// StatusUpdater updates pod with given PodCondition
type StatusUpdater interface {
UpdatePod(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error)
UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error)
UpdatePodGroup(pg *v1alpha1.PodGroup) (*v1alpha1.PodGroup, error)
}

0 comments on commit 5a70bf2

Please sign in to comment.