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
f0fb21e4
Commit
f0fb21e4
authored
Jun 20, 2017
by
Shyam Jeedigunta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retry service syncs with exponential backoff in endpoints-controller
parent
e28f7b47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
endpoints_controller.go
pkg/controller/endpoint/endpoints_controller.go
+23
-5
No files found.
pkg/controller/endpoint/endpoints_controller.go
View file @
f0fb21e4
...
...
@@ -44,6 +44,13 @@ import (
)
const
(
// maxRetries is the number of times a service will be retried before it is dropped out of the queue.
// With the current rate-limiter in use (5ms*2^(maxRetries-1)) the following numbers represent the
// sequence of delays between successive queuings of a service.
//
// 5ms, 10ms, 20ms, 40ms, 80ms, 160ms, 320ms, 640ms, 1.3s, 2.6s, 5.1s, 10.2s, 20.4s, 41s, 82s
maxRetries
=
15
// An annotation on the Service denoting if the endpoints controller should
// go ahead and create endpoints for unready pods. This annotation is
// currently only used by StatefulSets, where we need the pod to be DNS
...
...
@@ -265,15 +272,26 @@ func (e *EndpointController) processNextWorkItem() bool {
defer
e
.
queue
.
Done
(
eKey
)
err
:=
e
.
syncService
(
eKey
.
(
string
))
e
.
handleErr
(
err
,
eKey
)
return
true
}
func
(
e
*
EndpointController
)
handleErr
(
err
error
,
key
interface
{})
{
if
err
==
nil
{
e
.
queue
.
Forget
(
eK
ey
)
return
true
e
.
queue
.
Forget
(
k
ey
)
return
}
utilruntime
.
HandleError
(
fmt
.
Errorf
(
"Sync %v failed with %v"
,
eKey
,
err
))
e
.
queue
.
AddRateLimited
(
eKey
)
if
e
.
queue
.
NumRequeues
(
key
)
<
maxRetries
{
glog
.
V
(
2
)
.
Infof
(
"Error syncing endpoints for service %q: %v"
,
key
,
err
)
e
.
queue
.
AddRateLimited
(
key
)
return
}
return
true
glog
.
Warningf
(
"Dropping service %q out of the queue: %v"
,
key
,
err
)
e
.
queue
.
Forget
(
key
)
utilruntime
.
HandleError
(
err
)
}
func
(
e
*
EndpointController
)
syncService
(
key
string
)
error
{
...
...
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