Merge pull request #48920 from AmarNathChary/updated_yaml_to_json

Switch extensible admission payload example from YAML to JSON
This commit is contained in:
Kubernetes Prow Robot 2025-02-12 23:56:23 -08:00 committed by GitHub
commit 97cbae19d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 87 additions and 76 deletions

View File

@ -282,98 +282,109 @@ This example shows the data contained in an `AdmissionReview` object
for a request to update the `scale` subresource of an `apps/v1` `Deployment`: for a request to update the `scale` subresource of an `apps/v1` `Deployment`:
```yaml ```yaml
apiVersion: admission.k8s.io/v1 {
kind: AdmissionReview "apiVersion": "admission.k8s.io/v1",
request: "kind": "AdmissionReview",
# Random uid uniquely identifying this admission call "request": {
uid: 705ab4f5-6393-11e8-b7cc-42010a800002 # Random uid uniquely identifying this admission call
"uid": "705ab4f5-6393-11e8-b7cc-42010a800002",
# Fully-qualified group/version/kind of the incoming object # Fully-qualified group/version/kind of the incoming object
kind: "kind": {
group: autoscaling "group": "autoscaling",
version: v1 "version": "v1",
kind: Scale "kind": "Scale"
},
# Fully-qualified group/version/kind of the resource being modified # Fully-qualified group/version/kind of the resource being modified
resource: "resource": {
group: apps "group": "apps",
version: v1 "version": "v1",
resource: deployments "resource": "deployments"
},
# subresource, if the request is to a subresource # Subresource, if the request is to a subresource
subResource: scale "subResource": "scale",
# Fully-qualified group/version/kind of the incoming object in the original request to the API server. # Fully-qualified group/version/kind of the incoming object in the original request to the API server
# This only differs from `kind` if the webhook specified `matchPolicy: Equivalent` and the # This only differs from `kind` if the webhook specified `matchPolicy: Equivalent` and the original
# original request to the API server was converted to a version the webhook registered for. # request to the API server was converted to a version the webhook registered for
requestKind: "requestKind": {
group: autoscaling "group": "autoscaling",
version: v1 "version": "v1",
kind: Scale "kind": "Scale"
},
# Fully-qualified group/version/kind of the resource being modified in the original request to the API server. # Fully-qualified group/version/kind of the resource being modified in the original request to the API server
# This only differs from `resource` if the webhook specified `matchPolicy: Equivalent` and the # This only differs from `resource` if the webhook specified `matchPolicy: Equivalent` and the original
# original request to the API server was converted to a version the webhook registered for. # request to the API server was converted to a version the webhook registered for
requestResource: "requestResource": {
group: apps "group": "apps",
version: v1 "version": "v1",
resource: deployments "resource": "deployments"
},
# subresource, if the request is to a subresource # Subresource, if the request is to a subresource
# This only differs from `subResource` if the webhook specified `matchPolicy: Equivalent` and the # This only differs from `subResource` if the webhook specified `matchPolicy: Equivalent` and the original
# original request to the API server was converted to a version the webhook registered for. # request to the API server was converted to a version the webhook registered for
requestSubResource: scale "requestSubResource": "scale",
# Name of the resource being modified # Name of the resource being modified
name: my-deployment "name": "my-deployment",
# Namespace of the resource being modified, if the resource is namespaced (or is a Namespace object) # Namespace of the resource being modified, if the resource is namespaced (or is a Namespace object)
namespace: my-namespace "namespace": "my-namespace",
# operation can be CREATE, UPDATE, DELETE, or CONNECT # operation can be CREATE, UPDATE, DELETE, or CONNECT
operation: UPDATE "operation": "UPDATE",
userInfo: "userInfo": {
# Username of the authenticated user making the request to the API server # Username of the authenticated user making the request to the API server
username: admin "username": "admin",
# UID of the authenticated user making the request to the API server # UID of the authenticated user making the request to the API server
uid: 014fbff9a07c "uid": "014fbff9a07c",
# Group memberships of the authenticated user making the request to the API server # Group memberships of the authenticated user making the request to the API server
groups: "groups": [
- system:authenticated "system:authenticated",
- my-admin-group "my-admin-group"
# Arbitrary extra info associated with the user making the request to the API server. ],
# This is populated by the API server authentication layer and should be included
# if any SubjectAccessReview checks are performed by the webhook.
extra:
some-key:
- some-value1
- some-value2
# object is the new object being admitted. # Arbitrary extra info associated with the user making the request to the API server
# It is null for DELETE operations. # This is populated by the API server authentication layer
object: "extra": {
apiVersion: autoscaling/v1 "some-key": [
kind: Scale "some-value1",
"some-value2"
]
}
},
# oldObject is the existing object. # object is the new object being admitted. It is null for DELETE operations
# It is null for CREATE and CONNECT operations. "object": {
oldObject: "apiVersion": "autoscaling/v1",
apiVersion: autoscaling/v1 "kind": "Scale"
kind: Scale },
# options contains the options for the operation being admitted, like meta.k8s.io/v1 CreateOptions, UpdateOptions, or DeleteOptions. # oldObject is the existing object. It is null for CREATE and CONNECT operations
# It is null for CONNECT operations. "oldObject": {
options: "apiVersion": "autoscaling/v1",
apiVersion: meta.k8s.io/v1 "kind": "Scale"
kind: UpdateOptions },
# dryRun indicates the API request is running in dry run mode and will not be persisted. # options contain the options for the operation being admitted, like meta.k8s.io/v1 CreateOptions,
# Webhooks with side effects should avoid actuating those side effects when dryRun is true. # UpdateOptions, or DeleteOptions. It is null for CONNECT operations
# See http://k8s.io/docs/reference/using-api/api-concepts/#make-a-dry-run-request for more details. "options": {
dryRun: False "apiVersion": "meta.k8s.io/v1",
"kind": "UpdateOptions"
},
# dryRun indicates the API request is running in dry run mode and will not be persisted
# Webhooks with side effects should avoid actuating those side effects when dryRun is true
"dryRun": false
}
}
``` ```
### Response ### Response