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
4ac2f745
Commit
4ac2f745
authored
Jan 21, 2016
by
Alex Mohr
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19533 from kargakis/bloated-job-status-fix
Fix job status conditions bloat
parents
95469099
dd84bba6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
controller.go
pkg/controller/job/controller.go
+4
-4
controller_test.go
pkg/controller/job/controller_test.go
+24
-0
No files found.
pkg/controller/job/controller.go
View file @
4ac2f745
...
...
@@ -330,11 +330,11 @@ func (jm *JobController) syncJob(key string) error {
now
:=
unversioned
.
Now
()
job
.
Status
.
StartTime
=
&
now
}
// if job was finished previously, we don't want to redo the termination
if
isJobFinished
(
&
job
)
{
return
nil
}
if
pastActiveDeadline
(
&
job
)
{
// if job was finished previously, we don't want to redo the termination
if
isJobFinished
(
&
job
)
{
return
nil
}
// TODO: below code should be replaced with pod termination resulting in
// pod failures, rather than killing pods. Unfortunately none such solution
// exists ATM. There's an open discussion in the topic in
...
...
pkg/controller/job/controller_test.go
View file @
4ac2f745
...
...
@@ -359,7 +359,31 @@ func TestSyncPastDeadlineJobFinished(t *testing.T) {
if
actual
!=
nil
{
t
.
Error
(
"Unexpected job modification"
)
}
}
func
TestSyncJobComplete
(
t
*
testing
.
T
)
{
client
:=
client
.
NewOrDie
(
&
client
.
Config
{
Host
:
""
,
GroupVersion
:
testapi
.
Default
.
GroupVersion
()})
manager
:=
NewJobController
(
client
,
controller
.
NoResyncPeriodFunc
)
fakePodControl
:=
controller
.
FakePodControl
{}
manager
.
podControl
=
&
fakePodControl
manager
.
podStoreSynced
=
alwaysReady
job
:=
newJob
(
1
,
1
)
job
.
Status
.
Conditions
=
append
(
job
.
Status
.
Conditions
,
newCondition
(
extensions
.
JobComplete
,
""
,
""
))
manager
.
jobStore
.
Store
.
Add
(
job
)
err
:=
manager
.
syncJob
(
getKey
(
job
,
t
))
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error when syncing jobs %v"
,
err
)
}
uncastJob
,
_
,
err
:=
manager
.
jobStore
.
Store
.
Get
(
job
)
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error when trying to get job from the store: %v"
,
err
)
}
actual
:=
uncastJob
.
(
*
extensions
.
Job
)
// Verify that after syncing a complete job, the conditions are the same.
if
got
,
expected
:=
len
(
actual
.
Status
.
Conditions
),
1
;
got
!=
expected
{
t
.
Fatalf
(
"Unexpected job status conditions amount; expected %d, got %d"
,
expected
,
got
)
}
}
func
TestSyncJobDeleted
(
t
*
testing
.
T
)
{
...
...
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