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
543a0691
Commit
543a0691
authored
Mar 06, 2016
by
Prashanth Balasubramanian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Poll for gc'd pods.
parent
2e038223
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
garbage_collector.go
test/e2e/garbage_collector.go
+25
-8
No files found.
test/e2e/garbage_collector.go
View file @
543a0691
...
@@ -17,13 +17,14 @@ limitations under the License.
...
@@ -17,13 +17,14 @@ limitations under the License.
package
e2e
package
e2e
import
(
import
(
"fmt"
"time"
"time"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/wait"
)
)
// This test requires that --terminated-pod-gc-threshold=100 be set on the controller manager
// This test requires that --terminated-pod-gc-threshold=100 be set on the controller manager
...
@@ -51,14 +52,30 @@ var _ = Describe("Garbage collector [Slow]", func() {
...
@@ -51,14 +52,30 @@ var _ = Describe("Garbage collector [Slow]", func() {
}
}
Logf
(
"created: %v"
,
count
)
Logf
(
"created: %v"
,
count
)
// This sleep has to be longer than the gcCheckPeriod defined
// in pkg/controller/gc/gc_controller.go which is currently
// 20 seconds.
time
.
Sleep
(
30
*
time
.
Second
)
pods
,
err
:=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
List
(
api
.
ListOptions
{})
// The gc controller polls every 30s and fires off a goroutine per
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
// pod to terminate.
Expect
(
len
(
pods
.
Items
))
.
To
(
BeNumerically
(
"=="
,
100
))
var
err
error
var
pods
*
api
.
PodList
timeout
:=
2
*
time
.
Minute
gcThreshold
:=
100
By
(
fmt
.
Sprintf
(
"Waiting for gc controller to gc all but %d pods"
,
gcThreshold
))
pollErr
:=
wait
.
Poll
(
30
*
time
.
Second
,
timeout
,
func
()
(
bool
,
error
)
{
pods
,
err
=
f
.
Client
.
Pods
(
f
.
Namespace
.
Name
)
.
List
(
api
.
ListOptions
{})
if
err
!=
nil
{
Logf
(
"Failed to list pod %v"
,
err
)
return
false
,
nil
}
if
len
(
pods
.
Items
)
!=
gcThreshold
{
Logf
(
"Number of observed pods %v, waiting for %v"
,
len
(
pods
.
Items
),
gcThreshold
)
return
false
,
nil
}
return
true
,
nil
})
if
pollErr
!=
nil
{
Failf
(
"Failed to GC pods within %v, %v pods remaining, error: %v"
,
timeout
,
len
(
pods
.
Items
),
err
)
}
})
})
})
})
...
...
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