mirror of
https://github.com/rancher/steve.git
synced 2025-09-08 18:59:58 +00:00
Update to k8s v1.20
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/authentication/authenticator"
|
||||
"k8s.io/apiserver/pkg/authentication/token/cache"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
@@ -16,6 +17,16 @@ import (
|
||||
"k8s.io/client-go/transport"
|
||||
)
|
||||
|
||||
var (
|
||||
// Default value taken from DefaultAuthWebhookRetryBackoff
|
||||
WebhookBackoff = wait.Backoff{
|
||||
Duration: 500 * time.Millisecond,
|
||||
Factor: 1.5,
|
||||
Jitter: 0.2,
|
||||
Steps: 5,
|
||||
}
|
||||
)
|
||||
|
||||
var ExistingContext = ToMiddleware(AuthenticatorFunc(func(req *http.Request) (user.Info, bool, error) {
|
||||
user, ok := request.UserFrom(req.Context())
|
||||
return user, ok, nil
|
||||
@@ -72,7 +83,7 @@ func WebhookConfigForURL(url string) (string, error) {
|
||||
}
|
||||
|
||||
func NewWebhookAuthenticator(cacheTTL time.Duration, kubeConfigFile string) (Authenticator, error) {
|
||||
wh, err := webhook.New(kubeConfigFile, "v1", nil, nil)
|
||||
wh, err := webhook.New(kubeConfigFile, "v1", nil, WebhookBackoff, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user