mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #31354 from janetkuo/sj-replace-e2e
Automatic merge from submit-queue Update sj on UpdateStatus return value Fixes #30542, #30549 cc @erictune
This commit is contained in:
commit
a4665cff64
@ -149,10 +149,11 @@ func SyncOne(sj batch.ScheduledJob, js []batch.Job, now time.Time, jc jobControl
|
||||
}
|
||||
}
|
||||
}
|
||||
err := sjc.UpdateStatus(&sj)
|
||||
updatedSJ, err := sjc.UpdateStatus(&sj)
|
||||
if err != nil {
|
||||
glog.Errorf("Unable to update status for %s: %v", nameForLog, err)
|
||||
glog.Errorf("Unable to update status for %s (rv = %s): %v", nameForLog, sj.ResourceVersion, err)
|
||||
}
|
||||
sj = *updatedSJ
|
||||
|
||||
if sj.Spec.Suspend != nil && *sj.Spec.Suspend {
|
||||
glog.V(4).Infof("Not starting job for %s because it is suspended", nameForLog)
|
||||
@ -280,8 +281,8 @@ func SyncOne(sj batch.ScheduledJob, js []batch.Job, now time.Time, jc jobControl
|
||||
sj.Status.Active = append(sj.Status.Active, *ref)
|
||||
}
|
||||
sj.Status.LastScheduleTime = &unversioned.Time{Time: scheduledTime}
|
||||
if err := sjc.UpdateStatus(&sj); err != nil {
|
||||
glog.Infof("Unable to update status for %s: %v", nameForLog, err)
|
||||
if _, err := sjc.UpdateStatus(&sj); err != nil {
|
||||
glog.Infof("Unable to update status for %s (rv = %s): %v", nameForLog, sj.ResourceVersion, err)
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
// sjControlInterface is an interface that knows how to update ScheduledJob status
|
||||
// created as an interface to allow testing.
|
||||
type sjControlInterface interface {
|
||||
UpdateStatus(sj *batch.ScheduledJob) error
|
||||
UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error)
|
||||
}
|
||||
|
||||
// realSJControl is the default implementation of sjControlInterface.
|
||||
@ -39,9 +39,8 @@ type realSJControl struct {
|
||||
|
||||
var _ sjControlInterface = &realSJControl{}
|
||||
|
||||
func (c *realSJControl) UpdateStatus(sj *batch.ScheduledJob) error {
|
||||
_, err := c.KubeClient.Batch().ScheduledJobs(sj.Namespace).UpdateStatus(sj)
|
||||
return err
|
||||
func (c *realSJControl) UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) {
|
||||
return c.KubeClient.Batch().ScheduledJobs(sj.Namespace).UpdateStatus(sj)
|
||||
}
|
||||
|
||||
// fakeSJControl is the default implementation of sjControlInterface.
|
||||
@ -51,9 +50,9 @@ type fakeSJControl struct {
|
||||
|
||||
var _ sjControlInterface = &fakeSJControl{}
|
||||
|
||||
func (c *fakeSJControl) UpdateStatus(sj *batch.ScheduledJob) error {
|
||||
func (c *fakeSJControl) UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) {
|
||||
c.Updates = append(c.Updates, *sj)
|
||||
return nil
|
||||
return sj, nil
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ //
|
||||
|
Loading…
Reference in New Issue
Block a user