Skip to content

Commit

Permalink
Merge pull request #70060 from pbarker/audit-webhook
Browse files Browse the repository at this point in the history
updates shared apiserver webhook client
  • Loading branch information
k8s-ci-robot committed Oct 23, 2018
2 parents 1af393d + 5874a1f commit 9fb4a2a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions staging/src/k8s.io/apiserver/pkg/util/webhook/client.go
Expand Up @@ -66,14 +66,14 @@ func NewClientManager(gv schema.GroupVersion, addToSchemaFunc func(s *runtime.Sc
if err != nil {
return ClientManager{}, err
}
admissionScheme := runtime.NewScheme()
if err := addToSchemaFunc(admissionScheme); err != nil {
hookScheme := runtime.NewScheme()
if err := addToSchemaFunc(hookScheme); err != nil {
return ClientManager{}, err
}
return ClientManager{
cache: cache,
negotiatedSerializer: serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{
Serializer: serializer.NewCodecFactory(admissionScheme).LegacyCodec(gv),
Serializer: serializer.NewCodecFactory(hookScheme).LegacyCodec(gv),
}),
}, nil
}
Expand Down
4 changes: 2 additions & 2 deletions staging/src/k8s.io/apiserver/pkg/util/webhook/error.go
Expand Up @@ -28,7 +28,7 @@ type ErrCallingWebhook struct {

func (e *ErrCallingWebhook) Error() string {
if e.Reason != nil {
return fmt.Sprintf("failed calling admission webhook %q: %v", e.WebhookName, e.Reason)
return fmt.Sprintf("failed calling webhook %q: %v", e.WebhookName, e.Reason)
}
return fmt.Sprintf("failed calling admission webhook %q; no further details available", e.WebhookName)
return fmt.Sprintf("failed calling webhook %q; no further details available", e.WebhookName)
}
4 changes: 2 additions & 2 deletions staging/src/k8s.io/apiserver/pkg/util/webhook/webhook.go
Expand Up @@ -37,7 +37,7 @@ const defaultRequestTimeout = 30 * time.Second

type GenericWebhook struct {
RestClient *rest.RESTClient
initialBackoff time.Duration
InitialBackoff time.Duration
}

// NewGenericWebhook creates a new GenericWebhook from the provided kubeconfig file.
Expand Down Expand Up @@ -83,7 +83,7 @@ func newGenericWebhook(scheme *runtime.Scheme, codecFactory serializer.CodecFact
// it returns an error for which apierrors.SuggestsClientDelay() or apierrors.IsInternalError() returns true.
func (g *GenericWebhook) WithExponentialBackoff(webhookFn func() rest.Result) rest.Result {
var result rest.Result
WithExponentialBackoff(g.initialBackoff, func() error {
WithExponentialBackoff(g.InitialBackoff, func() error {
result = webhookFn()
return result.Error()
})
Expand Down

0 comments on commit 9fb4a2a

Please sign in to comment.