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
59bacba0
Commit
59bacba0
authored
Oct 15, 2017
by
Mik Vyatskov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always retry network connection error in webhook
Signed-off-by:
Mik Vyatskov
<
vmik@google.com
>
parent
4ad4e1ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
BUILD
staging/src/k8s.io/apiserver/pkg/util/webhook/BUILD
+1
-0
webhook.go
staging/src/k8s.io/apiserver/pkg/util/webhook/webhook.go
+3
-5
No files found.
staging/src/k8s.io/apiserver/pkg/util/webhook/BUILD
View file @
59bacba0
...
@@ -15,6 +15,7 @@ go_library(
...
@@ -15,6 +15,7 @@ go_library(
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd:go_default_library",
...
...
staging/src/k8s.io/apiserver/pkg/util/webhook/webhook.go
View file @
59bacba0
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/runtime/serializer"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
runtimeserializer
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/rest"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd"
...
@@ -104,17 +105,14 @@ func WithExponentialBackoff(initialBackoff time.Duration, webhookFn func() error
...
@@ -104,17 +105,14 @@ func WithExponentialBackoff(initialBackoff time.Duration, webhookFn func() error
var
err
error
var
err
error
wait
.
ExponentialBackoff
(
backoff
,
func
()
(
bool
,
error
)
{
wait
.
ExponentialBackoff
(
backoff
,
func
()
(
bool
,
error
)
{
err
=
webhookFn
()
err
=
webhookFn
()
// these errors indicate a
need to retry an authentication check
// these errors indicate a
transient error that should be retried.
if
apierrors
.
IsServerTimeout
(
err
)
||
apierrors
.
IsTimeout
(
err
)
||
apierrors
.
IsTooManyRequests
(
err
)
{
if
net
.
IsConnectionReset
(
err
)
||
apierrors
.
IsInternalError
(
err
)
||
apierrors
.
IsTimeout
(
err
)
||
apierrors
.
IsTooManyRequests
(
err
)
{
return
false
,
nil
return
false
,
nil
}
}
// if the error sends the Retry-After header, we respect it as an explicit confirmation we should retry.
// if the error sends the Retry-After header, we respect it as an explicit confirmation we should retry.
if
_
,
shouldRetry
:=
apierrors
.
SuggestsClientDelay
(
err
);
shouldRetry
{
if
_
,
shouldRetry
:=
apierrors
.
SuggestsClientDelay
(
err
);
shouldRetry
{
return
false
,
nil
return
false
,
nil
}
}
if
apierrors
.
IsInternalError
(
err
)
{
return
false
,
nil
}
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
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