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
54d49cb4
Commit
54d49cb4
authored
Dec 01, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
While updating NodeStatus, only first get served from cache
parent
5658addb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
kubelet_node_status.go
pkg/kubelet/kubelet_node_status.go
+7
-4
No files found.
pkg/kubelet/kubelet_node_status.go
View file @
54d49cb4
...
@@ -298,7 +298,7 @@ func (kl *Kubelet) syncNodeStatus() {
...
@@ -298,7 +298,7 @@ func (kl *Kubelet) syncNodeStatus() {
// updateNodeStatus updates node status to master with retries.
// updateNodeStatus updates node status to master with retries.
func
(
kl
*
Kubelet
)
updateNodeStatus
()
error
{
func
(
kl
*
Kubelet
)
updateNodeStatus
()
error
{
for
i
:=
0
;
i
<
nodeStatusUpdateRetry
;
i
++
{
for
i
:=
0
;
i
<
nodeStatusUpdateRetry
;
i
++
{
if
err
:=
kl
.
tryUpdateNodeStatus
();
err
!=
nil
{
if
err
:=
kl
.
tryUpdateNodeStatus
(
i
);
err
!=
nil
{
glog
.
Errorf
(
"Error updating node status, will retry: %v"
,
err
)
glog
.
Errorf
(
"Error updating node status, will retry: %v"
,
err
)
}
else
{
}
else
{
return
nil
return
nil
...
@@ -309,20 +309,23 @@ func (kl *Kubelet) updateNodeStatus() error {
...
@@ -309,20 +309,23 @@ func (kl *Kubelet) updateNodeStatus() error {
// tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0
// tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0
// is set, this function will also confirm that cbr0 is configured correctly.
// is set, this function will also confirm that cbr0 is configured correctly.
func
(
kl
*
Kubelet
)
tryUpdateNodeStatus
()
error
{
func
(
kl
*
Kubelet
)
tryUpdateNodeStatus
(
tryNumber
int
)
error
{
// In large clusters, GET and PUT operations on Node objects coming
// In large clusters, GET and PUT operations on Node objects coming
// from here are the majority of load on apiserver and etcd.
// from here are the majority of load on apiserver and etcd.
// To reduce the load on etcd, we are serving GET operations from
// To reduce the load on etcd, we are serving GET operations from
// apiserver cache (the data might be slightly delayed but it doesn't
// apiserver cache (the data might be slightly delayed but it doesn't
// seem to cause more confilict - the delays are pretty small).
// seem to cause more confilict - the delays are pretty small).
// If it result in a conflict, all retries are served directly from etcd.
// TODO: Currently apiserver doesn't support serving GET operations
// TODO: Currently apiserver doesn't support serving GET operations
// from its cache. Thus we are hacking it by issuing LIST with
// from its cache. Thus we are hacking it by issuing LIST with
// field selector for the name of the node (field selectors with
// field selector for the name of the node (field selectors with
// specified name are handled efficiently by apiserver). Once
// specified name are handled efficiently by apiserver). Once
// apiserver supports GET from cache, change it here.
// apiserver supports GET from cache, change it here.
opts
:=
v1
.
ListOptions
{
opts
:=
v1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
string
(
kl
.
nodeName
)}
.
AsSelector
()
.
String
(),
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
string
(
kl
.
nodeName
)}
.
AsSelector
()
.
String
(),
ResourceVersion
:
"0"
,
}
if
tryNumber
==
0
{
opts
.
ResourceVersion
=
"0"
}
}
nodes
,
err
:=
kl
.
kubeClient
.
Core
()
.
Nodes
()
.
List
(
opts
)
nodes
,
err
:=
kl
.
kubeClient
.
Core
()
.
Nodes
()
.
List
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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