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
fd874ab1
Commit
fd874ab1
authored
Oct 14, 2016
by
gmarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PodGCController waits for informer sync before doing anything.
parent
f73afdc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
gc_controller.go
pkg/controller/podgc/gc_controller.go
+4
-0
gc_controller_test.go
pkg/controller/podgc/gc_controller_test.go
+12
-0
No files found.
pkg/controller/podgc/gc_controller.go
View file @
fd874ab1
...
...
@@ -112,6 +112,10 @@ func (gcc *PodGCController) Run(stop <-chan struct{}) {
}
func
(
gcc
*
PodGCController
)
gc
()
{
if
!
gcc
.
podController
.
HasSynced
()
||
!
gcc
.
nodeController
.
HasSynced
()
{
glog
.
V
(
2
)
.
Infof
(
"PodGCController is waiting for informer sync..."
)
return
}
pods
,
err
:=
gcc
.
podStore
.
List
(
labels
.
Everything
())
if
err
!=
nil
{
glog
.
Errorf
(
"Error while listing all Pods: %v"
,
err
)
...
...
pkg/controller/podgc/gc_controller_test.go
View file @
fd874ab1
...
...
@@ -28,6 +28,14 @@ import (
"k8s.io/kubernetes/pkg/util/sets"
)
type
FakeController
struct
{}
func
(
*
FakeController
)
Run
(
<-
chan
struct
{})
{}
func
(
*
FakeController
)
HasSynced
()
bool
{
return
true
}
func
TestGCTerminated
(
t
*
testing
.
T
)
{
type
nameToPhase
struct
{
name
string
...
...
@@ -111,6 +119,8 @@ func TestGCTerminated(t *testing.T) {
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
"node"
},
})
gcc
.
nodeStore
=
cache
.
StoreToNodeLister
{
Store
:
store
}
gcc
.
podController
=
&
FakeController
{}
gcc
.
nodeController
=
&
FakeController
{}
gcc
.
gc
()
...
...
@@ -181,6 +191,8 @@ func TestGCOrphaned(t *testing.T) {
store
:=
cache
.
NewStore
(
cache
.
MetaNamespaceKeyFunc
)
gcc
.
nodeStore
=
cache
.
StoreToNodeLister
{
Store
:
store
}
gcc
.
podController
=
&
FakeController
{}
gcc
.
nodeController
=
&
FakeController
{}
gcc
.
gc
()
...
...
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