You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/reference/using-api/api-concepts.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,16 +334,16 @@ are not vulnerable to ordering changes in the list.
334
334
Once the last finalizer is removed, the resource is actually removed from etcd.
335
335
336
336
337
-
## Dryrun
337
+
## Dry-run
338
338
339
-
{{< feature-state for_k8s_version="v1.13" state="beta" >}} In version 1.13, the dryrun beta feature is enabled by default. The modifying verbs (`POST`, `PUT`, `PATCH`, and `DELETE`) can accept requests in a dryrun mode. Dry run mode helps to evaluate a request through the typical request stages (admission chain, validation, merge conflicts) up until persisting objects to storage. The response body for the request is as close as possible to a nondryrun response. The system guarantees that dryrun requests will not be persisted in storage or have any other side effects.
339
+
{{< feature-state for_k8s_version="v1.13" state="beta" >}} In version 1.13, the dry-run beta feature is enabled by default. The modifying verbs (`POST`, `PUT`, `PATCH`, and `DELETE`) can accept requests in a dry-run mode. DryRun mode helps to evaluate a request through the typical request stages (admission chain, validation, merge conflicts) up until persisting objects to storage. The response body for the request is as close as possible to a non-dry-run response. The system guarantees that dry-run requests will not be persisted in storage or have any other side effects.
340
340
341
341
342
-
### Make a dryrun request
342
+
### Make a dry-run request
343
343
344
-
Dryrun is triggered by setting the `dryRun` query parameter. This parameter is a string, working as an enum, and in 1.13 the only accepted values are:
344
+
Dry-run is triggered by setting the `dryRun` query parameter. This parameter is a string, working as an enum, and in 1.13 the only accepted values are:
345
345
346
-
* `All`: Every stage runs as normal, except for the final storage stage. Admission controllers are run to check that the request is valid, mutating controllers mutate the request, merge is performed on `PATCH`, fields are defaulted, and schema validation occurs. The changes are not persisted to the underlying storage, but the final object which would have been persisted is still returned to the user, along with the normal status code. If the request would trigger an admission controller which would have side effects, the request will be failed rather than risk an unwanted side effect. All built in admission control plugins support dry run. Additionally, admission webhooks can declare in their [configuration object](/docs/reference/generated/kubernetes-api/v1.13/#webhook-v1beta1-admissionregistration-k8s-io) that they do not have side effects by setting the sideEffects field to "None". If a webhook actually does have side effects, then the sideEffects field should be set to "NoneOnDryRun", and the webhook should also be modified to understand the `DryRun` field in AdmissionReview, and prevent side effects on dry run requests.
346
+
* `All`: Every stage runs as normal, except for the final storage stage. Admission controllers are run to check that the request is valid, mutating controllers mutate the request, merge is performed on `PATCH`, fields are defaulted, and schema validation occurs. The changes are not persisted to the underlying storage, but the final object which would have been persisted is still returned to the user, along with the normal status code. If the request would trigger an admission controller which would have side effects, the request will be failed rather than risk an unwanted side effect. All built in admission control plugins support dry-run. Additionally, admission webhooks can declare in their [configuration object](/docs/reference/generated/kubernetes-api/v1.13/#webhook-v1beta1-admissionregistration-k8s-io) that they do not have side effects by setting the sideEffects field to "None". If a webhook actually does have side effects, then the sideEffects field should be set to "NoneOnDryRun", and the webhook should also be modified to understand the `DryRun` field in AdmissionReview, and prevent side effects on dry-run requests.
347
347
* Leave the value empty, which is also the default: Keep the default modifying behavior.
348
348
349
349
For example:
@@ -352,12 +352,28 @@ For example:
352
352
Content-Type: application/json
353
353
Accept: application/json
354
354
355
-
The response would look the same as for nondryrun request, but the values of some generated fields may differ.
355
+
The response would look the same as for non-dry-run request, but the values of some generated fields may differ.
356
356
357
+
### Dry-run authorization
358
+
359
+
Authorization for dry-run and non-dry-run requests is identical. Thus, to make
360
+
a dry-run request, the user must be authorized to make the non-dry-run request.
361
+
362
+
For example, to run a dry-run `PATCH` for Deployments, you must have the
363
+
`PATCH` permission for Deployments, as in the example of the RBAC rule below.
364
+
365
+
```yaml
366
+
rules:
367
+
- apiGroups: ["extensions", "apps"]
368
+
resources: ["deployments"]
369
+
verbs: ["patch"]
370
+
```
371
+
372
+
See [Authorization Overview](/docs/reference/access-authn-authz/authorization/).
357
373
358
374
### Generated values
359
375
360
-
Some values of an object are typically generated before the object is persisted. It is important not to rely upon the values of these fields set by a dryrun request, since these values will likely be different in dryrun mode from when the real request is made. Some of these fields are:
376
+
Some values of an object are typically generated before the object is persisted. It is important not to rely upon the values of these fields set by a dry-run request, since these values will likely be different in dry-run mode from when the real request is made. Some of these fields are:
361
377
362
378
* `name`: if `generateName` is set, `name` will have a unique random name
363
379
* `creationTimestamp`/`deletionTimestamp`: records the time of creation/deletion
0 commit comments