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
01d025a7
Commit
01d025a7
authored
Feb 25, 2017
by
Anthony Yeh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ControllerRefManager: Don't always filter inactive Pods.
Some controllers, like DaemonSet, want to see all Pods.
parent
db666525
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
14 deletions
+21
-14
controller_ref_manager.go
pkg/controller/controller_ref_manager.go
+0
-5
replica_set.go
pkg/controller/replicaset/replica_set.go
+11
-5
replication_controller.go
pkg/controller/replication/replication_controller.go
+10
-4
No files found.
pkg/controller/controller_ref_manager.go
View file @
01d025a7
...
@@ -163,11 +163,6 @@ func (m *PodControllerRefManager) ClaimPods(pods []*v1.Pod) ([]*v1.Pod, error) {
...
@@ -163,11 +163,6 @@ func (m *PodControllerRefManager) ClaimPods(pods []*v1.Pod) ([]*v1.Pod, error) {
}
}
for
_
,
pod
:=
range
pods
{
for
_
,
pod
:=
range
pods
{
if
!
IsPodActive
(
pod
)
{
glog
.
V
(
4
)
.
Infof
(
"Ignoring inactive pod %v/%v in state %v, deletion time %v"
,
pod
.
Namespace
,
pod
.
Name
,
pod
.
Status
.
Phase
,
pod
.
DeletionTimestamp
)
continue
}
ok
,
err
:=
m
.
claimObject
(
pod
,
adopt
,
release
)
ok
,
err
:=
m
.
claimObject
(
pod
,
adopt
,
release
)
if
err
!=
nil
{
if
err
!=
nil
{
errlist
=
append
(
errlist
,
err
)
errlist
=
append
(
errlist
,
err
)
...
...
pkg/controller/replicaset/replica_set.go
View file @
01d025a7
...
@@ -541,18 +541,24 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
...
@@ -541,18 +541,24 @@ func (rsc *ReplicaSetController) syncReplicaSet(key string) error {
return
nil
return
nil
}
}
// NOTE: filteredPods are pointing to objects from cache - if you need to
// modify them, you need to copy it first.
// TODO: Do the List and Filter in a single pass, or use an index.
var
filteredPods
[]
*
v1
.
Pod
// list all pods to include the pods that don't match the rs`s selector
// list all pods to include the pods that don't match the rs`s selector
// anymore but has the stale controller ref.
// anymore but has the stale controller ref.
// TODO: Do the List and Filter in a single pass, or use an index.
pods
,
err
:=
rsc
.
podLister
.
Pods
(
rs
.
Namespace
)
.
List
(
labels
.
Everything
())
pods
,
err
:=
rsc
.
podLister
.
Pods
(
rs
.
Namespace
)
.
List
(
labels
.
Everything
())
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// Ignore inactive pods.
var
filteredPods
[]
*
v1
.
Pod
for
_
,
pod
:=
range
pods
{
if
controller
.
IsPodActive
(
pod
)
{
filteredPods
=
append
(
filteredPods
,
pod
)
}
}
cm
:=
controller
.
NewPodControllerRefManager
(
rsc
.
podControl
,
rs
,
selector
,
controllerKind
)
cm
:=
controller
.
NewPodControllerRefManager
(
rsc
.
podControl
,
rs
,
selector
,
controllerKind
)
filteredPods
,
err
=
cm
.
ClaimPods
(
pods
)
// NOTE: filteredPods are pointing to objects from cache - if you need to
// modify them, you need to copy it first.
filteredPods
,
err
=
cm
.
ClaimPods
(
filteredPods
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/controller/replication/replication_controller.go
View file @
01d025a7
...
@@ -559,17 +559,23 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
...
@@ -559,17 +559,23 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
rcNeedsSync
:=
rm
.
expectations
.
SatisfiedExpectations
(
key
)
rcNeedsSync
:=
rm
.
expectations
.
SatisfiedExpectations
(
key
)
trace
.
Step
(
"Expectations restored"
)
trace
.
Step
(
"Expectations restored"
)
// NOTE: filteredPods are pointing to objects from cache - if you need to
// modify them, you need to copy it first.
// TODO: Do the List and Filter in a single pass, or use an index.
var
filteredPods
[]
*
v1
.
Pod
// list all pods to include the pods that don't match the rc's selector
// list all pods to include the pods that don't match the rc's selector
// anymore but has the stale controller ref.
// anymore but has the stale controller ref.
// TODO: Do the List and Filter in a single pass, or use an index.
pods
,
err
:=
rm
.
podLister
.
Pods
(
rc
.
Namespace
)
.
List
(
labels
.
Everything
())
pods
,
err
:=
rm
.
podLister
.
Pods
(
rc
.
Namespace
)
.
List
(
labels
.
Everything
())
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
// Ignore inactive pods.
var
filteredPods
[]
*
v1
.
Pod
for
_
,
pod
:=
range
pods
{
if
controller
.
IsPodActive
(
pod
)
{
filteredPods
=
append
(
filteredPods
,
pod
)
}
}
cm
:=
controller
.
NewPodControllerRefManager
(
rm
.
podControl
,
rc
,
labels
.
Set
(
rc
.
Spec
.
Selector
)
.
AsSelectorPreValidated
(),
controllerKind
)
cm
:=
controller
.
NewPodControllerRefManager
(
rm
.
podControl
,
rc
,
labels
.
Set
(
rc
.
Spec
.
Selector
)
.
AsSelectorPreValidated
(),
controllerKind
)
// NOTE: filteredPods are pointing to objects from cache - if you need to
// modify them, you need to copy it first.
filteredPods
,
err
=
cm
.
ClaimPods
(
pods
)
filteredPods
,
err
=
cm
.
ClaimPods
(
pods
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
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