Skip to content

Commit 57ef99a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into docs-rebuild
2 parents d130213 + d3b3711 commit 57ef99a

File tree

3 files changed

+53
-21
lines changed

3 files changed

+53
-21
lines changed

docs/.nav.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ nav:
143143
- Configure resource requests and limits: serving/services/configure-requests-limits-services.md
144144
- Configuring probes: serving/services/configure-probing.md
145145
- Configuring HTTP: serving/services/http-protocol.md
146+
- Performing Dry Run: serving/dryrun.md
146147
- Volume Support: serving/services/storage.md
147148
- Traffic management: serving/traffic-management.md
148149
- Configuring gradual rollout of traffic to Revisions: serving/rolling-out-latest-revision.md

docs/serving/configuration/feature-flags.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -321,27 +321,6 @@ spec:
321321
...
322322
```
323323

324-
### Kubernetes dry run
325-
326-
* **Type**: Extension
327-
* **ConfigMap key:** `kubernetes.podspec-dryrun`
328-
329-
This flag controls whether Knative attempts to validate the Pod spec derived from a Knative Service spec, by using the Kubernetes API server before accepting the object.
330-
331-
When this extension is `enabled`, the server always runs this validation.
332-
333-
When this extension is `allowed`, the server does not run this validation by default.
334-
335-
When this extension is `allowed`, you can run this validation for individual Services, by adding the `features.knative.dev/podspec-dryrun: enabled` annotation:
336-
337-
```yaml
338-
apiVersion: serving.knative.dev/v1
339-
kind: Service
340-
metadata:
341-
annotations: features.knative.dev/podspec-dryrun: enabled
342-
...
343-
```
344-
345324
### Kubernetes runtime class
346325

347326
* **Type**: Extension

docs/serving/dryrun.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
audience: developer
3+
components:
4+
- serving
5+
function: how-to
6+
---
7+
8+
# Validating Resource Using Server-Side Dry Run
9+
10+
Kubernetes dry run lets you ask the API server to admit, default, and validate your object without persisting it to etcd. This is useful to verify that your Knative `Service`, `Configuration`, or `Route` specs are valid and to preview defaults before creating or updating resources.
11+
12+
Use server-side dry run (`--dry-run=server`), which sends the request to the API server with the `dryRun=All` flag. The API server executes admission, defaulting, and validation (including Knative Serving webhooks) but does not persist the object.
13+
14+
What gets validated in server-side dry run
15+
16+
- Knative Serving schema validation for `Service`, `Configuration`, `Route`, and related objects.
17+
- Knative defaulting webhooks apply defaults (for example, missing fields in `spec.template` are defaulted). You can see these defaults with `-o yaml`.
18+
- Kubernetes admission and validation (quotas, RBAC, OpenAPI validation, etc.).
19+
20+
Limitations and notes
21+
22+
- No resources are created or modified. Controllers do not reconcile and no Pods are started.
23+
- External systems are not contacted. For example, image digest resolution by the queue/reconciler and runtime readiness checks do not occur during a dry run.
24+
- Feature gates and validations are the same as for a real request against your current cluster version/configuration.
25+
- Server-side dry run requires a Kubernetes version that supports it (GA since v1.18).
26+
27+
Example
28+
29+
```bash
30+
# Validate the inline manifest above without creating it
31+
kubectl apply --dry-run=server -o yaml -f - <<EOF
32+
apiVersion: serving.knative.dev/v1
33+
kind: Service
34+
metadata:
35+
name: helloworld-go
36+
namespace: default
37+
spec:
38+
template:
39+
spec:
40+
containers:
41+
- image: ghcr.io/knative/helloworld-go:latest
42+
env:
43+
- name: TARGET
44+
value: "Knative"
45+
EOF
46+
```
47+
48+
Troubleshooting
49+
50+
- If server-side dry run fails with validation errors, fix the reported fields in your manifest and retry.
51+
- If you see RBAC errors, ensure your user has permission to create/update the indicated resource kind in the target namespace.
52+

0 commit comments

Comments
 (0)