Skip to content

Commit 4c8ae8b

Browse files
committed
address comments
1 parent b9c79d3 commit 4c8ae8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apis/contexts.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func IsDryRun(ctx context.Context) bool {
246246
// This is attached to contexts passed to webhook interfaces with
247247
// additional context from the HTTP request.
248248
type httpReq struct{}
249-
type AdmissionReq struct{}
249+
type admissionRequest struct{}
250250

251251
// WithHTTPRequest associated the HTTP request object the webhook
252252
// received with the context.
@@ -266,12 +266,12 @@ func GetHTTPRequest(ctx context.Context) *http.Request {
266266
// WithAdmissionRequest associated the admissionv1.AdmissionRequest object the webhook
267267
// received with the context.
268268
func WithAdmissionRequest(ctx context.Context, r *admissionv1.AdmissionRequest) context.Context {
269-
return context.WithValue(ctx, AdmissionReq{}, r)
269+
return context.WithValue(ctx, admissionRequest{}, r)
270270
}
271271

272272
// GetAdmissionRequest fetches the admissionv1.AdmissionRequest received by the webhook.
273273
func GetAdmissionRequest(ctx context.Context) *admissionv1.AdmissionRequest {
274-
v := ctx.Value(AdmissionReq{})
274+
v := ctx.Value(admissionRequest{})
275275
if v == nil {
276276
return nil
277277
}

webhook/admission.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func admissionHandler(rootLogger *zap.SugaredLogger, stats StatsReporter, c Admi
111111
)
112112

113113
ctx := logging.WithLogger(r.Context(), logger)
114-
ctx = apis.WithHTTPRequest(ctx, r)
114+
ctx = apis.WithAdmissionRequest(ctx, review.Request)
115115

116116
response := admissionv1.AdmissionReview{
117117
// Use the same type meta as the request - this is required by the K8s API

0 commit comments

Comments
 (0)