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
a371f3ba
Unverified
Commit
a371f3ba
authored
Jan 15, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track run status explicitly rather than non-nil check on stopCh
parent
23881a90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+1
-3
graph_builder.go
pkg/controller/garbagecollector/graph_builder.go
+7
-5
resource_quota_monitor.go
pkg/controller/resourcequota/resource_quota_monitor.go
+7
-5
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
a371f3ba
...
@@ -171,9 +171,7 @@ func Run(s *options.CMServer) error {
...
@@ -171,9 +171,7 @@ func Run(s *options.CMServer) error {
}
}
if
!
s
.
LeaderElection
.
LeaderElect
{
if
!
s
.
LeaderElection
.
LeaderElect
{
stopCh
:=
make
(
chan
struct
{})
run
(
wait
.
NeverStop
)
defer
close
(
stopCh
)
run
(
stopCh
)
panic
(
"unreachable"
)
panic
(
"unreachable"
)
}
}
...
...
pkg/controller/garbagecollector/graph_builder.go
View file @
a371f3ba
...
@@ -83,13 +83,14 @@ type GraphBuilder struct {
...
@@ -83,13 +83,14 @@ type GraphBuilder struct {
// After that it is safe to start them here, before that it is not.
// After that it is safe to start them here, before that it is not.
informersStarted
<-
chan
struct
{}
informersStarted
<-
chan
struct
{}
// stopCh drives shutdown. If it is nil, it indicates that Run() has not been
// stopCh drives shutdown. When a receive from it unblocks, monitors will shut down.
// called yet. If it is non-nil, then when closed it indicates everything
// should shut down.
//
// This channel is also protected by monitorLock.
// This channel is also protected by monitorLock.
stopCh
<-
chan
struct
{}
stopCh
<-
chan
struct
{}
// running tracks whether Run() has been called.
// it is protected by monitorLock.
running
bool
// metaOnlyClientPool uses a special codec, which removes fields except for
// metaOnlyClientPool uses a special codec, which removes fields except for
// apiVersion, kind, and metadata during decoding.
// apiVersion, kind, and metadata during decoding.
metaOnlyClientPool
dynamic
.
ClientPool
metaOnlyClientPool
dynamic
.
ClientPool
...
@@ -275,7 +276,7 @@ func (gb *GraphBuilder) startMonitors() {
...
@@ -275,7 +276,7 @@ func (gb *GraphBuilder) startMonitors() {
gb
.
monitorLock
.
Lock
()
gb
.
monitorLock
.
Lock
()
defer
gb
.
monitorLock
.
Unlock
()
defer
gb
.
monitorLock
.
Unlock
()
if
gb
.
stopCh
==
nil
{
if
!
gb
.
running
{
return
return
}
}
...
@@ -325,6 +326,7 @@ func (gb *GraphBuilder) Run(stopCh <-chan struct{}) {
...
@@ -325,6 +326,7 @@ func (gb *GraphBuilder) Run(stopCh <-chan struct{}) {
// Set up the stop channel.
// Set up the stop channel.
gb
.
monitorLock
.
Lock
()
gb
.
monitorLock
.
Lock
()
gb
.
stopCh
=
stopCh
gb
.
stopCh
=
stopCh
gb
.
running
=
true
gb
.
monitorLock
.
Unlock
()
gb
.
monitorLock
.
Unlock
()
// Start monitors and begin change processing until the stop channel is
// Start monitors and begin change processing until the stop channel is
...
...
pkg/controller/resourcequota/resource_quota_monitor.go
View file @
a371f3ba
...
@@ -74,13 +74,14 @@ type QuotaMonitor struct {
...
@@ -74,13 +74,14 @@ type QuotaMonitor struct {
// After that it is safe to start them here, before that it is not.
// After that it is safe to start them here, before that it is not.
informersStarted
<-
chan
struct
{}
informersStarted
<-
chan
struct
{}
// stopCh drives shutdown. If it is nil, it indicates that Run() has not been
// stopCh drives shutdown. When a receive from it unblocks, monitors will shut down.
// called yet. If it is non-nil, then when closed it indicates everything
// should shut down.
//
// This channel is also protected by monitorLock.
// This channel is also protected by monitorLock.
stopCh
<-
chan
struct
{}
stopCh
<-
chan
struct
{}
// running tracks whether Run() has been called.
// it is protected by monitorLock.
running
bool
// monitors are the producer of the resourceChanges queue
// monitors are the producer of the resourceChanges queue
resourceChanges
workqueue
.
RateLimitingInterface
resourceChanges
workqueue
.
RateLimitingInterface
...
@@ -241,7 +242,7 @@ func (qm *QuotaMonitor) startMonitors() {
...
@@ -241,7 +242,7 @@ func (qm *QuotaMonitor) startMonitors() {
qm
.
monitorLock
.
Lock
()
qm
.
monitorLock
.
Lock
()
defer
qm
.
monitorLock
.
Unlock
()
defer
qm
.
monitorLock
.
Unlock
()
if
qm
.
stopCh
==
nil
{
if
!
qm
.
running
{
return
return
}
}
...
@@ -291,6 +292,7 @@ func (qm *QuotaMonitor) Run(stopCh <-chan struct{}) {
...
@@ -291,6 +292,7 @@ func (qm *QuotaMonitor) Run(stopCh <-chan struct{}) {
// Set up the stop channel.
// Set up the stop channel.
qm
.
monitorLock
.
Lock
()
qm
.
monitorLock
.
Lock
()
qm
.
stopCh
=
stopCh
qm
.
stopCh
=
stopCh
qm
.
running
=
true
qm
.
monitorLock
.
Unlock
()
qm
.
monitorLock
.
Unlock
()
// Start monitors and begin change processing until the stop channel is
// Start monitors and begin change processing until the stop channel is
...
...
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