Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a4665cff
Commit
a4665cff
authored
Aug 25, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Aug 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
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
parents
d836b248
2b87b46a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
controller.go
pkg/controller/scheduledjob/controller.go
+5
-4
injection.go
pkg/controller/scheduledjob/injection.go
+5
-6
No files found.
pkg/controller/scheduledjob/controller.go
View file @
a4665cff
...
@@ -149,10 +149,11 @@ func SyncOne(sj batch.ScheduledJob, js []batch.Job, now time.Time, jc jobControl
...
@@ -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
{
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
{
if
sj
.
Spec
.
Suspend
!=
nil
&&
*
sj
.
Spec
.
Suspend
{
glog
.
V
(
4
)
.
Infof
(
"Not starting job for %s because it is suspended"
,
nameForLog
)
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
...
@@ -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
.
Active
=
append
(
sj
.
Status
.
Active
,
*
ref
)
}
}
sj
.
Status
.
LastScheduleTime
=
&
unversioned
.
Time
{
Time
:
scheduledTime
}
sj
.
Status
.
LastScheduleTime
=
&
unversioned
.
Time
{
Time
:
scheduledTime
}
if
err
:=
sjc
.
UpdateStatus
(
&
sj
);
err
!=
nil
{
if
_
,
err
:=
sjc
.
UpdateStatus
(
&
sj
);
err
!=
nil
{
glog
.
Infof
(
"Unable to update status for %s
: %v"
,
nameForLog
,
err
)
glog
.
Infof
(
"Unable to update status for %s
(rv = %s): %v"
,
nameForLog
,
sj
.
ResourceVersion
,
err
)
}
}
return
return
...
...
pkg/controller/scheduledjob/injection.go
View file @
a4665cff
...
@@ -29,7 +29,7 @@ import (
...
@@ -29,7 +29,7 @@ import (
// sjControlInterface is an interface that knows how to update ScheduledJob status
// sjControlInterface is an interface that knows how to update ScheduledJob status
// created as an interface to allow testing.
// created as an interface to allow testing.
type
sjControlInterface
interface
{
type
sjControlInterface
interface
{
UpdateStatus
(
sj
*
batch
.
ScheduledJob
)
error
UpdateStatus
(
sj
*
batch
.
ScheduledJob
)
(
*
batch
.
ScheduledJob
,
error
)
}
}
// realSJControl is the default implementation of sjControlInterface.
// realSJControl is the default implementation of sjControlInterface.
...
@@ -39,9 +39,8 @@ type realSJControl struct {
...
@@ -39,9 +39,8 @@ type realSJControl struct {
var
_
sjControlInterface
=
&
realSJControl
{}
var
_
sjControlInterface
=
&
realSJControl
{}
func
(
c
*
realSJControl
)
UpdateStatus
(
sj
*
batch
.
ScheduledJob
)
error
{
func
(
c
*
realSJControl
)
UpdateStatus
(
sj
*
batch
.
ScheduledJob
)
(
*
batch
.
ScheduledJob
,
error
)
{
_
,
err
:=
c
.
KubeClient
.
Batch
()
.
ScheduledJobs
(
sj
.
Namespace
)
.
UpdateStatus
(
sj
)
return
c
.
KubeClient
.
Batch
()
.
ScheduledJobs
(
sj
.
Namespace
)
.
UpdateStatus
(
sj
)
return
err
}
}
// fakeSJControl is the default implementation of sjControlInterface.
// fakeSJControl is the default implementation of sjControlInterface.
...
@@ -51,9 +50,9 @@ type fakeSJControl struct {
...
@@ -51,9 +50,9 @@ type fakeSJControl struct {
var
_
sjControlInterface
=
&
fakeSJControl
{}
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
)
c
.
Updates
=
append
(
c
.
Updates
,
*
sj
)
return
nil
return
sj
,
nil
}
}
// ------------------------------------------------------------------ //
// ------------------------------------------------------------------ //
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment