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
f6c2560f
Commit
f6c2560f
authored
May 13, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #25565 from wojtek-t/traces_in_replication_controller
Automatic merge from submit-queue Add traces to ReplicationController Ref #25563
parents
4ce3d5f2
327c9486
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
replication_controller.go
pkg/controller/replication/replication_controller.go
+8
-0
No files found.
pkg/controller/replication/replication_controller.go
View file @
f6c2560f
...
@@ -35,6 +35,7 @@ import (
...
@@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/controller/framework/informers"
"k8s.io/kubernetes/pkg/controller/framework/informers"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/metrics"
"k8s.io/kubernetes/pkg/util/metrics"
utilruntime
"k8s.io/kubernetes/pkg/util/runtime"
utilruntime
"k8s.io/kubernetes/pkg/util/runtime"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/pkg/util/wait"
...
@@ -529,6 +530,9 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
...
@@ -529,6 +530,9 @@ func (rm *ReplicationManager) manageReplicas(filteredPods []*api.Pod, rc *api.Re
// it did not expect to see any more of its pods created or deleted. This function is not meant to be invoked
// it did not expect to see any more of its pods created or deleted. This function is not meant to be invoked
// concurrently with the same key.
// concurrently with the same key.
func
(
rm
*
ReplicationManager
)
syncReplicationController
(
key
string
)
error
{
func
(
rm
*
ReplicationManager
)
syncReplicationController
(
key
string
)
error
{
trace
:=
util
.
NewTrace
(
"syncReplicationController: "
+
key
)
defer
trace
.
LogIfLong
(
250
*
time
.
Millisecond
)
startTime
:=
time
.
Now
()
startTime
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
glog
.
V
(
4
)
.
Infof
(
"Finished syncing controller %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
glog
.
V
(
4
)
.
Infof
(
"Finished syncing controller %q (%v)"
,
key
,
time
.
Now
()
.
Sub
(
startTime
))
...
@@ -563,19 +567,23 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
...
@@ -563,19 +567,23 @@ func (rm *ReplicationManager) syncReplicationController(key string) error {
glog
.
Errorf
(
"Couldn't get key for replication controller %#v: %v"
,
rc
,
err
)
glog
.
Errorf
(
"Couldn't get key for replication controller %#v: %v"
,
rc
,
err
)
return
err
return
err
}
}
trace
.
Step
(
"ReplicationController restored"
)
rcNeedsSync
:=
rm
.
expectations
.
SatisfiedExpectations
(
rcKey
)
rcNeedsSync
:=
rm
.
expectations
.
SatisfiedExpectations
(
rcKey
)
trace
.
Step
(
"Expectations restored"
)
podList
,
err
:=
rm
.
podStore
.
Pods
(
rc
.
Namespace
)
.
List
(
labels
.
Set
(
rc
.
Spec
.
Selector
)
.
AsSelector
())
podList
,
err
:=
rm
.
podStore
.
Pods
(
rc
.
Namespace
)
.
List
(
labels
.
Set
(
rc
.
Spec
.
Selector
)
.
AsSelector
())
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Error getting pods for rc %q: %v"
,
key
,
err
)
glog
.
Errorf
(
"Error getting pods for rc %q: %v"
,
key
,
err
)
rm
.
queue
.
Add
(
key
)
rm
.
queue
.
Add
(
key
)
return
err
return
err
}
}
trace
.
Step
(
"Pods listed"
)
// TODO: Do this in a single pass, or use an index.
// TODO: Do this in a single pass, or use an index.
filteredPods
:=
controller
.
FilterActivePods
(
podList
.
Items
)
filteredPods
:=
controller
.
FilterActivePods
(
podList
.
Items
)
if
rcNeedsSync
{
if
rcNeedsSync
{
rm
.
manageReplicas
(
filteredPods
,
&
rc
)
rm
.
manageReplicas
(
filteredPods
,
&
rc
)
}
}
trace
.
Step
(
"manageReplicas done"
)
// Count the number of pods that have labels matching the labels of the pod
// Count the number of pods that have labels matching the labels of the pod
// template of the replication controller, the matching pods may have more
// template of the replication controller, the matching pods may have more
...
...
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