---
title: "Mutate pod. Inject New Relic Agent env vars."
method: POST
path: "/mutate"
---

# Mutate pod. Inject New Relic Agent env vars.

`POST /mutate`

## Request

- Base URL: `https://newrelic-metadata-injection-svc.default.svc`
- URL: `https://newrelic-metadata-injection-svc.default.svc/mutate`
- Auth: none declared
- TypeScript: <https://skmtc.dev/newrelic/apis/new-relic-kubernetes-metadata-injection-mutatingadmissionweb/docs/mutate/post.ts> (a function with typed inputs; its response is checked against the schema)

The injection of New Relic APM Metadata is implemented as a webhook using Kubernetes MutatingAdmissionWebhook. This is the entry point of such Webhook.

## Query parameters

- `timeout` string

## Request body

- AdmissionReviewRequest
  - `request` AdmissionRequest, required
    - `uid` string: Identifier for the individual request/response. This should be copied over from the corresponding AdmissionRequest

## Response `200`

The request was successful. Note that in case the status field is present, the mutation was not executed.

- AdmissionReviewResponse
  - `response` AdmissionResponse, required
    - `allowed` boolean: Indicates whether or not the admission request was permitted. If false, the creation of the related workload will fail no matters the chosen failurePolicy
    - `patch` string: The patch body. Currently there is only support "JSONPatch" which implements RFC 6902
    - `patchType` 'JSONPatch': The type of Patch. Currently only "JSONPatch" is allowed
    - `status` AdmissionResponseStatus: Status is present in case the mutation was not executed.
      - `message` string: A human-readable description of of why this operation is in the "Failure" status or was not "allowed".
      - `reason` string: A machine-readable description of why this operation is in the "Failure" status or was not "allowed". If "message" is set then this value is not used.
    - `uid` string: Identifier for the individual request/response. This should be copied over from the corresponding AdmissionRequest

## Other responses

- `400`: Bad request.
- `500`: Internal server error.

---

[API](https://skmtc.dev/newrelic/apis/new-relic-kubernetes-metadata-injection-mutatingadmissionweb.md) - [All operations](https://skmtc.dev/newrelic/apis/new-relic-kubernetes-metadata-injection-mutatingadmissionweb/llms.txt) - [OpenAPI document](https://skmtc.dev/newrelic/apis/new-relic-kubernetes-metadata-injection-mutatingadmissionweb/revisions/8a90bc2d4cd2?raw)
