diff --git a/pkg/webhook/admission/defaulter_custom.go b/pkg/webhook/admission/defaulter_custom.go index 56c262988f..d65727e62c 100644 --- a/pkg/webhook/admission/defaulter_custom.go +++ b/pkg/webhook/admission/defaulter_custom.go @@ -60,7 +60,7 @@ func (h *defaulterForType) Handle(ctx context.Context, req Request) Response { panic("object should never be nil") } - ctx = newContextWithRequest(ctx, req) + ctx = NewContextWithRequest(ctx, req) // Get the object in the request obj := h.object.DeepCopyObject() diff --git a/pkg/webhook/admission/validator_custom.go b/pkg/webhook/admission/validator_custom.go index 978b2bcbf3..33252f1134 100644 --- a/pkg/webhook/admission/validator_custom.go +++ b/pkg/webhook/admission/validator_custom.go @@ -64,7 +64,7 @@ func (h *validatorForType) Handle(ctx context.Context, req Request) Response { panic("object should never be nil") } - ctx = newContextWithRequest(ctx, req) + ctx = NewContextWithRequest(ctx, req) // Get the object in the request obj := h.object.DeepCopyObject() diff --git a/pkg/webhook/admission/webhook.go b/pkg/webhook/admission/webhook.go index baa83d66f1..cfc46637c3 100644 --- a/pkg/webhook/admission/webhook.go +++ b/pkg/webhook/admission/webhook.go @@ -266,8 +266,8 @@ func RequestFromContext(ctx context.Context) (Request, error) { return Request{}, errors.New("admission.Request not found in context") } -// newContextWithRequest returns a new Context, derived from ctx, which carries the +// NewContextWithRequest returns a new Context, derived from ctx, which carries the // provided admission.Request. -func newContextWithRequest(ctx context.Context, req Request) context.Context { +func NewContextWithRequest(ctx context.Context, req Request) context.Context { return context.WithValue(ctx, requestContextKey{}, req) }