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
33385214
Commit
33385214
authored
Mar 09, 2017
by
wenlxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recycle pod can't get the event since the channel been closed
parent
2828db8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
util.go
pkg/volume/util.go
+16
-8
No files found.
pkg/volume/util.go
View file @
33385214
...
@@ -97,7 +97,10 @@ func internalRecycleVolumeByWatchingPodUntilCompletion(pvName string, pod *v1.Po
...
@@ -97,7 +97,10 @@ func internalRecycleVolumeByWatchingPodUntilCompletion(pvName string, pod *v1.Po
// Now only the old pod or the new pod run. Watch it until it finishes
// Now only the old pod or the new pod run. Watch it until it finishes
// and send all events on the pod to the PV
// and send all events on the pod to the PV
for
{
for
{
event
:=
<-
podCh
event
,
ok
:=
<-
podCh
if
!
ok
{
return
fmt
.
Errorf
(
"recycler pod %q watch channel had been closed"
,
pod
.
Name
)
}
switch
event
.
Object
.
(
type
)
{
switch
event
.
Object
.
(
type
)
{
case
*
v1
.
Pod
:
case
*
v1
.
Pod
:
// POD changed
// POD changed
...
@@ -199,13 +202,14 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
...
@@ -199,13 +202,14 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
return
nil
,
err
return
nil
,
err
}
}
eventCh
:=
make
(
chan
watch
.
Event
,
0
)
eventCh
:=
make
(
chan
watch
.
Event
,
3
0
)
go
func
()
{
go
func
()
{
defer
eventWatch
.
Stop
()
defer
eventWatch
.
Stop
()
defer
podWatch
.
Stop
()
defer
podWatch
.
Stop
()
defer
close
(
eventCh
)
defer
close
(
eventCh
)
var
podWatchChannelClosed
bool
var
eventWatchChannelClosed
bool
for
{
for
{
select
{
select
{
case
_
=
<-
stopChannel
:
case
_
=
<-
stopChannel
:
...
@@ -213,15 +217,19 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
...
@@ -213,15 +217,19 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
case
podEvent
,
ok
:=
<-
podWatch
.
ResultChan
()
:
case
podEvent
,
ok
:=
<-
podWatch
.
ResultChan
()
:
if
!
ok
{
if
!
ok
{
return
podWatchChannelClosed
=
true
}
else
{
eventCh
<-
podEvent
}
}
eventCh
<-
podEvent
case
eventEvent
,
ok
:=
<-
eventWatch
.
ResultChan
()
:
case
eventEvent
,
ok
:=
<-
eventWatch
.
ResultChan
()
:
if
!
ok
{
if
!
ok
{
return
eventWatchChannelClosed
=
true
}
else
{
eventCh
<-
eventEvent
}
}
eventCh
<-
eventEvent
}
if
podWatchChannelClosed
&&
eventWatchChannelClosed
{
break
}
}
}
}
}()
}()
...
...
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