Add per-revision examples to serving config (#4966)

* Add per-revision examples to serving config

* make global config first tab, clean up formatting

* some updates for revision configs

* update option for Operator

* re-add config map setting

* updates from SME

* minor updates
This commit is contained in:
Ashleigh Brennan 2022-06-08 09:14:38 -05:00 committed by GitHub
parent 05b52748df
commit bb64c6227e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 389 additions and 222 deletions

View File

@ -5,10 +5,12 @@ The `config-defaults` ConfigMap, known as the Defaults ConfigMap, contains setti
This ConfigMap is located in the `knative-serving` namespace. This ConfigMap is located in the `knative-serving` namespace.
You can view the current `config-defaults` ConfigMap by running the following command: You can view the current `config-defaults` ConfigMap by running the following command:
```yaml ```yaml
kubectl get configmap -n knative-serving config-defaults -oyaml kubectl get configmap -n knative-serving config-defaults -oyaml
``` ```
## Example config-defaults ConfigMap ## Example config-defaults ConfigMap
```yaml ```yaml
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -30,319 +32,484 @@ data:
allow-container-concurrency-zero: "true" allow-container-concurrency-zero: "true"
enable-service-links: "false" enable-service-links: "false"
``` ```
See below for a description of each property. See below for a description of each property.
## Properties ## Properties
### Revision Timeout Seconds
### Revision timeout seconds
{% raw %} {% raw %}
revision-timeout-seconds contains the default number of The revision timeout value determines the default number of seconds to use for the revision's per-request timeout if none is specified.
seconds to use for the revision's per-request timeout, if
none is specified.
{% endraw %} {% endraw %}
**Key**: `revision-timeout-seconds` * **Global key:** `revision-timeout-seconds`
* **Per-revision annotation key:** `timeout`
**Default**: `"300"` (5 minutes) * **Possible values:** integer
* **Default:** `"300"` (5 minutes)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-timeout-seconds: "300" # 5 minutes
```
### Max Revision Timeout Seconds === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-timeout-seconds: "300"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
timeout: 300
containers:
- image: gcr.io/knative-samples/helloworld-go
```
### Max revision timeout seconds
{% raw %} {% raw %}
max-revision-timeout-seconds contains the maximum number of The `max-revision-timeout-seconds` value determines the maximum number of seconds that can be used for `revision-timeout-seconds`. This value must be greater than or equal to `revision-timeout-seconds`. If omitted, the system default is used (600 seconds).
seconds that can be used for revision-timeout-seconds.
This value must be greater than or equal to revision-timeout-seconds.
If omitted, the system default is used (600 seconds).
If this value is increased, the activator's terminationGraceTimeSeconds If this value is increased, the activator's `terminationGraceTimeSeconds` should also be increased to prevent in-flight requests from being disrupted.
should also be increased to prevent in-flight requests being disrupted.
{% endraw %} {% endraw %}
**Key**: `max-revision-timeout-seconds` * **Global key:** `max-revision-timeout-seconds`
* **Per-revision annotation key:** N/A
**Default**: `"600"` (10 minutes) * **Possible values:** integer
* **Default:** `"600"` (10 minutes)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
max-revision-timeout-seconds: "600" # 10 minutes
```
### Revision Cpu Request === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
max-revision-timeout-seconds: "600"
```
### Revision CPU request
{% raw %} {% raw %}
revision-cpu-request contains the cpu allocation to assign The `revision-cpu-request` value determines the CPU allocation assigned to revisions by default. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
to revisions by default. If omitted, no value is specified
and the system default is used.
Below is an example of setting revision-cpu-request.
By default, it is not set by Knative.
{% endraw %} {% endraw %}
**Key**: `revision-cpu-request` * **Global key:** `revision-cpu-request`
* **Per-revision annotation key:** `cpu`
**Default**: `"400m"` (0.4 of a CPU (aka 400 milli-CPU)) * **Possible values:** integer
* **Default:** `"400m"` (0.4 of a CPU, or 400 milli-CPU)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-cpu-request: "400m" # 0.4 of a CPU (aka 400 milli-CPU)
```
### Revision Memory Request === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-cpu-request: "400m"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
cpu: "400m"
```
### Revision memory request
{% raw %} {% raw %}
revision-memory-request contains the memory allocation to assign The `revision-memory-request` value determines the memory allocation assigned
to revisions by default. If omitted, no value is specified to revisions by default. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
and the system default is used.
Below is an example of setting revision-memory-request.
By default, it is not set by Knative.
{% endraw %} {% endraw %}
**Key**: `revision-memory-request` * **Global key:** `revision-memory-request`
* **Per-revision annotation key:** `memory`
**Default**: `"100M"` (100 megabytes of memory) * **Possible values:** integer
* **Default:** `"100M"` (100 megabytes of memory)
**Example:** **Example:**
```yaml
apiVersion: v1 === "Global (ConfigMap)"
kind: ConfigMap ```yaml
metadata: apiVersion: v1
name: config-defaults kind: ConfigMap
namespace: knative-serving metadata:
data: name: config-defaults
revision-memory-request: "100M" # 100 megabytes of memory namespace: knative-serving
``` data:
revision-memory-request: "100M"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
memory: "100M"
```
### Revision Ephemeral Storage Request ### Revision Ephemeral Storage Request
{% raw %} {% raw %}
revision-ephemeral-storage-request contains the ephemeral storage The `revision-ephemeral-storage-request` value determines the ephemeral storage
allocation to assign to revisions by default. If omitted, no value is allocation assigned to revisions by default. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
specified and the system default is used.
{% endraw %} {% endraw %}
**Key**: `revision-ephemeral-storage-request` * **Global key:** `revision-ephemeral-storage-request`
* **Per-revision annotation key:** `ephemeral-storage`
**Default**: `"500M"` (500 megabytes of storage) * **Possible values:** integer
* **Default:** `"500M"` (500 megabytes of storage)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-ephemeral-storage-request: "500M" # 500 megabytes of storage
```
### Revision Cpu Limit === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-ephemeral-storage-request: "500M"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
ephemeral-storage: "500M"
```
### Revision CPU limit
{% raw %} {% raw %}
revision-cpu-limit contains the cpu allocation to limit The `revision-cpu-limit` value determines the default CPU allocation limit for revisions. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
revisions to by default. If omitted, no value is specified
and the system default is used.
Below is an example of setting revision-cpu-limit.
By default, it is not set by Knative.
{% endraw %} {% endraw %}
**Key**: `revision-cpu-limit` * **Global key:** `revision-cpu-limit`
* **Per-revision annotation key:** `cpu`
**Default**: `"1000m"` (1 CPU (aka 1000 milli-CPU)) * **Possible values:** integer
* **Default:** `"1000m"` (1 CPU, or 1000 milli-CPU)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-cpu-limit: "1000m" # 1 CPU (aka 1000 milli-CPU)
```
### Revision Memory Limit === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-cpu-limit: "1000m"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
cpu: "1000m"
```
### Revision memory limit
{% raw %} {% raw %}
revision-memory-limit contains the memory allocation to limit The `revision-memory-limit` value determines the default memory allocation limit for revisions. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
revisions to by default. If omitted, no value is specified
and the system default is used.
Below is an example of setting revision-memory-limit.
By default, it is not set by Knative.
{% endraw %} {% endraw %}
**Key**: `revision-memory-limit` * **Global key:** `revision-memory-limit`
* **Per-revision annotation key:** `memory`
**Default**: `"200M"` (200 megabytes of memory) * **Possible values:** integer
* **Default:** `"200M"` (200 megabytes of memory)
**Example:** **Example:**
```yaml
apiVersion: v1 === "Global (ConfigMap)"
kind: ConfigMap ```yaml
metadata: apiVersion: v1
name: config-defaults kind: ConfigMap
namespace: knative-serving metadata:
data: name: config-defaults
revision-memory-limit: "200M" # 200 megabytes of memory namespace: knative-serving
``` data:
revision-memory-limit: "200M"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
memory: "200M"
```
### Revision Ephemeral Storage Limit ### Revision Ephemeral Storage Limit
{% raw %} {% raw %}
revision-ephemeral-storage-limit contains the ephemeral storage The `revision-ephemeral-storage-limit` value determines the default ephemeral storage limit allocated to revisions. If this value is omitted, the system default is used. This key is not enabled by default for Knative.
allocation to limit revisions to by default. If omitted, no value is
specified and the system default is used.
{% endraw %} {% endraw %}
**Key**: `revision-ephemeral-storage-limit` * **Global key:** `revision-ephemeral-storage-limit`
* **Per-revision annotation key:** `ephemeral-storage`
**Default**: `"750M"` (750 megabytes of storage) * **Possible values:** integer
* **Default:** `"750M"` (750 megabytes of storage)
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-ephemeral-storage-limit: "750M" # 750 megabytes of storage
```
### Container Name Template === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
revision-ephemeral-storage-limit: "750M"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
resources:
requests:
ephemeral-storage: "750M"
```
### Container name template
{% raw %} {% raw %}
container-name-template contains a template for the default The `container-name-template` value provides a template for the default
container name, if none is specified. This field supports container name if no container name is specified. This field supports Go templating and is supplied by the `ObjectMeta` of the enclosing Service or Configuration, so values such as `{{.Name}}` are also valid.
Go templating and is supplied with the ObjectMeta of the
enclosing Service or Configuration, so values such as
{{.Name}} are also valid.
{% endraw %} {% endraw %}
**Key**: `container-name-template` * **Global key:** `container-name-template`
* **Per-revision annotation key:** `name`
**Default**: `"user-container"` * **Possible values:** string
* **Default:** `"user-container"`
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-name-template: "user-container"
```
### Container Concurrency === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-name-template: "user-container"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- name: user-container
image: gcr.io/knative-samples/helloworld-go
```
### Container concurrency
{% raw %} {% raw %}
container-concurrency specifies the maximum number The `container-concurrency` value specifies the maximum number of requests the container can handle at once. Requests above this threshold are queued. Setting a value of zero disables this throttling and lets through as many requests as
of requests the Container can handle at once, and requests
above this threshold are queued. Setting a value of zero
disables this throttling and lets through as many requests as
the pod receives. the pod receives.
{% endraw %} {% endraw %}
**Key**: `container-concurrency` * **Global key:** `container-concurrency`
* **Per-revision spec key:** `containerConcurrency`
**Default**: `"0"` * **Possible values:** integer
* **Default:** `"0"`
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-concurrency: "0"
```
### Container Concurrency Max Limit === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-concurrency: "0"
```
=== "Per Revision"
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containerConcurrency: 0
```
### Container concurrency max limit
{% raw %} {% raw %}
The container concurrency max limit is an operator setting ensuring that The `container-concurrency-max-limit` setting disables arbitrary large concurrency values, or autoscaling targets, for individual revisions. The `container-concurrency` default setting must be at or below this value. The value of the `container-concurrency-max-limit` setting must be greater than 1.
the individual revisions cannot have arbitrary large concurrency
values, or autoscaling targets. `container-concurrency` default setting
must be at or below this value.
Must be greater than 1.
!!! note !!! note
Even with this set, a user can choose a `containerConcurrency` value of 0 (unbounded) unless `allow-container-concurrency-zero` is set to "false". Even with this set, a user can choose a `containerConcurrency` value of zero (unbounded), unless `allow-container-concurrency-zero` is set to `"false"`.
{% endraw %} {% endraw %}
**Key**: `container-concurrency-max-limit` * **Global key:** `container-concurrency-max-limit`
* **Per-revision annotation key:** N/A
**Default**: `"1000"` * **Possible values:** integer
* **Default:** `"1000"`
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-concurrency-max-limit: "1000"
```
### Allow Container Concurrency Zero === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
container-concurrency-max-limit: "1000"
```
=== "Global (Operator)"
```yaml
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
name: knative-serving
namespace: knative-serving
spec:
config:
defaults:
container-concurrency-max-limit: "1000"
```
### Allow container concurrency zero
{% raw %} {% raw %}
allow-container-concurrency-zero controls whether users can The `allow-container-concurrency-zero` value determines whether users can
specify 0 (i.e. unbounded) for containerConcurrency. specify `0` (unbounded) for `containerConcurrency`.
{% endraw %} {% endraw %}
**Key**: `allow-container-concurrency-zero` * **Global key:** `allow-container-concurrency-zero`
* **Per-revision annotation key:** N/A
**Default**: `"true"` * **Possible values:** boolean
* **Default:** `"true"`
**Example:** **Example:**
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
allow-container-concurrency-zero: "true"
```
### Enable Service Links === "Global (ConfigMap)"
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: config-defaults
namespace: knative-serving
data:
allow-container-concurrency-zero: "true"
```
### Enable Service links
{% raw %} {% raw %}
enable-service-links specifies the default value used for the enableServiceLinks field of the PodSpec, when it is omitted by the user. See [the Kubernetes Documentation for the enableServiceLinks Feature](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service). The `enable-service-links` value specifies the default value used for the `enableServiceLinks` field of the `PodSpec` when it is omitted by the user. See [the Kubernetes documentation about the `enableServiceLinks` feature](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#accessing-the-service).
This is a tri-state flag with possible values of (true|false|default). This is a tri-state flag with possible values of (true|false|default).
In environments with large number of services it is suggested to set this value to `false`. See [serving#8498](https://github.com/knative/serving/issues/8498). In environments with large number of Services, it is suggested to set this value to `false`. See [serving#8498](https://github.com/knative/serving/issues/8498).
{% endraw %} {% endraw %}
**Key**: `enable-service-links` * **Global key:** `enable-service-links`
* **Per-revision annotation key:** N/A
**Default**: `"false"` * **Possible values:** `true|false|default`
* **Default:** `"false"`
**Example:** **Example:**
```yaml
apiVersion: v1 === "Global (ConfigMap)"
kind: ConfigMap ```yaml
metadata: apiVersion: v1
name: config-defaults kind: ConfigMap
namespace: knative-serving metadata:
data: name: config-defaults
enable-service-links: "false" namespace: knative-serving
``` data:
enable-service-links: "false"
```