Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,12 @@ include::modules/odc-importing-codebase-from-git-to-create-application.adoc[leve
include::modules/odc-deploying-java-applications.adoc[leveloffset=+1]

include::modules/odc-using-the-developer-catalog-to-add-services-or-components.adoc[leveloffset=+1]

[id="additional-resources_odc-creating-applications-using-developer-perspective"]
== Additional resources

* For more information about Knative routing settings for {ServerlessProductName}, see xref:../../serverless/develop/serverless-configuring-routes.adoc#serverless-configuring-routes[Routing].

* For more information about domain mapping settings for {ServerlessProductName}, see xref:../../serverless/security/serverless-custom-domains.adoc#serverless-custom-domains[Configuring a custom domain for a Knative service].

* For more information about Knative autoscaling settings for {ServerlessProductName}, see xref:../../serverless/develop/serverless-autoscaling-developer.adoc#serverless-autoscaling-developer[Autoscaling].
1 change: 1 addition & 0 deletions applications/creating_applications/snippets
32 changes: 7 additions & 25 deletions modules/odc-importing-codebase-from-git-to-create-application.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Module included in the following assemblies:
//
// * applications/creating_applications/odc-creating-applications-using-developer-perspective.adoc

:_content-type: PROCEDURE
[id="odc-importing-codebase-from-git-to-create-application_{context}"]
= Importing a codebase from Git to create an application
Expand Down Expand Up @@ -39,7 +43,6 @@ The resource name must be unique in a namespace. Modify the resource name if you
* *Deployment*, to create an application in plain Kubernetes style.
* *Deployment Config*, to create an {product-title} style application.
* *Serverless Deployment*, to create a Knative service.

+
[NOTE]
====
Expand All @@ -52,21 +55,8 @@ The *Serverless Deployment* option is displayed in the *Import from git* form on

. Optional: You can use the following advanced options to further customize your application:

Routing::
Click the *Routing* link to:
* Customize the hostname for the route.
* Specify the path the router watches.
* Select the target port for the traffic from the drop-down list.
* Secure your route by selecting the *Secure Route* check box. Select the required TLS termination type and set a policy for insecure traffic from the respective drop-down lists.
+
For serverless applications, the Knative service manages all the routing options above. However, you can customize the target port for traffic, if required. If the target port is not specified, the default port of `8080` is used.

Domain mapping::
If you are creating a *Serverless Deployment*, you can add a custom domain mapping to the Knative service during creation.
+
* In the *Advanced options* section, click *Show advanced Routing options*.
** If the domain mapping CR that you want to map to the service already exists, you can select it from the *Domain mapping* drop-down menu.
** If you want to create a new domain mapping CR, type the domain name into the box, and select the *Create* option. For example, if you type in `example.com`, the *Create* option is *Create "example.com"*.
include::snippets/routing-odc.adoc[]
include::snippets/serverless-domain-mapping-odc.adoc[]

Health Checks::
Click the *Health Checks* link to add Readiness, Liveness, and Startup probes to your application. All the probes have prepopulated default data; you can add the probes with the default data or customize it as required.
Expand All @@ -79,20 +69,12 @@ To customize the health probes:
+
For each of the probes, you can specify the request type - *HTTP GET*, *Container Command*, or *TCP Socket*, from the drop-down list. The form changes as per the selected request type. You can then modify the default values for the other parameters, such as the success and failure thresholds for the probe, number of seconds before performing the first probe after the container starts, frequency of the probe, and the timeout value.


Build Configuration and Deployment::
Click the *Build Configuration* and *Deployment* links to see the respective configuration options. Some options are selected by default; you can customize them further by adding the necessary triggers and environment variables.
+
For serverless applications, the *Deployment* option is not displayed as the Knative configuration resource maintains the desired state for your deployment instead of a `DeploymentConfig` resource.

Scaling::
Click the *Scaling* link to define the number of pods or instances of the application you want to deploy initially.
+
For serverless applications, you can:

* Set the upper and lower limit for the number of pods that can be set by the autoscaler. If the lower limit is not specified, it defaults to zero.
* Define the soft limit for the required number of concurrent requests per instance of the application at a given time. It is the recommended configuration for autoscaling. If not specified, it takes the value specified in the cluster configuration.
* Define the hard limit for the number of concurrent requests allowed per instance of the application at a given time. This is configured in the revision template. If not specified, it defaults to the value specified in the cluster configuration.
include::snippets/scaling-odc.adoc[]

Resource Limit::
Click the *Resource Limit* link to set the amount of *CPU* and *Memory* resources a container is guaranteed or allowed to use when running.
Expand Down
25 changes: 25 additions & 0 deletions modules/serverless-autoscaling-developer-maxscale.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Module included in the following assemblies:
//
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: REFERENCE
[id="serverless-autoscaling-developer-maxscale_context"]
= Maximum scale bounds

The maximum number of replicas that can serve an application is determined by the `maxScale` annotation. If the `maxScale` annotation is not set, there is no upper limit for the number of replicas created.

.Example service spec with `maxScale` annotation
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: example-service
namespace: default
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/maxScale: "10"
...
----
33 changes: 33 additions & 0 deletions modules/serverless-autoscaling-developer-minscale.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Module included in the following assemblies:
//
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: REFERENCE
[id="serverless-autoscaling-developer-minscale_{context}"]
= Minimum scale bounds

The minimum number of replicas that can serve an application is determined by the `minScale` annotation.

The `minScale` value defaults to `0` replicas if the following conditions are met:

* The `minScale` annotation is not set
* Scaling to zero is enabled
* The class `KPA` is used

If scale to zero is not enabled, the `minScale` value defaults to `1`.

.Example service spec with `minScale` annotation
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: example-service
namespace: default
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/minScale: "0"
...
----
9 changes: 7 additions & 2 deletions modules/serverless-autoscaling-maxscale-kn.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// Module is included in the following assemblies:
// Module included in the following assemblies:
//
// * serverless/autoscaling/serverless-autoscaling-scale-bounds.adoc
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: PROCEDURE
[id="serverless-autoscaling-maxscale-kn_{context}"]
= Setting the maxScale annotation by using the Knative CLI

You can use the `kn service` command with the `--max-scale` flag to create or modify the `--max-scale` value for a service.

.Prerequisites

* Knative Serving is installed on the cluster.
* You have installed the `kn` CLI.

.Procedure

* Set the maximum number of replicas for the service by using the `--max-scale` flag:
Expand Down
9 changes: 7 additions & 2 deletions modules/serverless-autoscaling-minscale-kn.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// Module is included in the following assemblies:
// Module included in the following assemblies:
//
// * serverless/autoscaling/serverless-autoscaling-scale-bounds.adoc
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: PROCEDURE
[id="serverless-autoscaling-minscale_{context}"]
= Setting the minScale annotation by using the Knative CLI

You can use the `kn service` command with the `--min-scale` flag to create or modify the `--min-scale` value for a service.

.Prerequisites

* Knative Serving is installed on the cluster.
* You have installed the `kn` CLI.

.Procedure

* Set the minimum number of replicas for the service by using the `--min-scale` flag:
Expand Down
2 changes: 1 addition & 1 deletion modules/serverless-concurrency-limits-configure-hard.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * serverless/autoscaling/serverless-autoscaling-concurrency.adoc
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: PROCEDURE
[id="serverless-concurrency-limits-configure-hard_{context}"]
Expand Down
2 changes: 1 addition & 1 deletion modules/serverless-concurrency-limits-configure-soft.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Module included in the following assemblies:
//
// * serverless/autoscaling/serverless-autoscaling-concurrency.adoc
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: PROCEDURE
[id="serverless-concurrency-limits-configure-soft_{context}"]
Expand Down
5 changes: 5 additions & 0 deletions modules/serverless-concurrency-limits.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Module included in the following assemblies:
//
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: CONCEPT
[id="serverless-concurrency-limits_{context}"]
= Concurrency limits and targets

Expand Down
3 changes: 2 additions & 1 deletion modules/serverless-target-utilization.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Module included in the following assemblies:
//
// * /serverless/autoscaling/serverless-autoscaling-concurrency.adoc
// * serverless/develop/serverless-autoscaling-developer.adoc

:_content-type: REFERENCE
[id="serverless-target-utilization_{context}"]
= Concurrency target utilization

Expand Down
1 change: 0 additions & 1 deletion serverless/channels/images

This file was deleted.

1 change: 0 additions & 1 deletion serverless/channels/modules

This file was deleted.

1 change: 1 addition & 0 deletions serverless/cli_tools/snippets
66 changes: 7 additions & 59 deletions serverless/develop/serverless-autoscaling-developer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ include::modules/serverless-document-attributes.adoc[]

toc::[]

Knative Serving provides automatic scaling, or _autoscaling_, for applications to match incoming demand. For example, if an application is receiving no traffic, and scale-to-zero is enabled, Knative Serving scales the application down to zero replicas. If scale-to-zero is disabled, the application is scaled down to the xref:../../serverless/develop/serverless-autoscaling-developer.adoc#serverless-autoscaling-developer-minscale[minimum number of replicas specified for applications on the cluster]. Replicas can also be scaled up to meet demand if traffic to the application increases.
Knative Serving provides automatic scaling, or _autoscaling_, for applications to match incoming demand. For example, if an application is receiving no traffic, and scale-to-zero is enabled, Knative Serving scales the application down to zero replicas. If scale-to-zero is disabled, the application is scaled down to the minimum number of replicas configured for applications on the cluster. Replicas can also be scaled up to meet demand if traffic to the application increases.

If Knative autoscaling is enabled for your cluster, you can configure concurrency and scale bounds for your application.
Autoscaling settings for Knative services can be global settings that are configured by cluster administrators, or per-revision settings that are configured for individual services. You can modify per-revision settings for your services by using the {product-title} web console, by modifying the YAML file for your service, or by using the `kn` CLI.

[NOTE]
====
Any limits or targets set in the revision template are measured against a single instance of your application. For example, setting the `target` annotation to `50` configures the autoscaler to scale the application so that each revision handles 50 requests at a time.
Any limits or targets that you set for a service are measured against a single instance of your application. For example, setting the `target` annotation to `50` configures the autoscaler to scale the application so that each revision handles 50 requests at a time.
====

[id="serverless-autoscaling-developer-scale-bounds"]
Expand All @@ -23,64 +23,12 @@ Scale bounds determine the minimum and maximum numbers of replicas that can serv

You can set scale bounds for an application to help prevent cold starts or control computing costs.

[id="serverless-autoscaling-developer-minscale"]
=== Minimum scale bounds

The minimum number of replicas that can serve an application is determined by the `minScale` annotation.

The `minScale` value defaults to `0` replicas if the following conditions are met:

* The `minScale` annotation is not set
* Scaling to zero is enabled
* The class `KPA` is used

If scale to zero is not enabled, the `minScale` value defaults to `1`.

// TODO: Document KPA if supported, link to docs about setting class

// TO DO:
// Add info / links about enabling and disabling autoscaling (admin docs)
// if `enable-scale-to-zero` is set to `false` in the `config-autoscaler` config map.

.Example service spec with `minScale` spec
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: example-service
namespace: default
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/minScale: "0"
...
----

// minscale docs
include::modules/serverless-autoscaling-developer-minscale.adoc[leveloffset=+2]
include::modules/serverless-autoscaling-minscale-kn.adoc[leveloffset=+3]

[id="serverless-autoscaling-developer-maxscale"]
=== Maximum scale bounds

The maximum number of replicas that can serve an application is determined by the `maxScale` annotation. If the `maxScale` annotation is not set, there is no upper limit for the number of replicas created.

.Example service spec with `maxScale` spec
[source,yaml]
----
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: example-service
namespace: default
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/maxScale: "10"
...
----

// maxscale docs
include::modules/serverless-autoscaling-developer-maxscale.adoc[leveloffset=+2]
include::modules/serverless-autoscaling-maxscale-kn.adoc[leveloffset=+3]

[id="serverless-autoscaling-developer-concurrency"]
Expand Down
1 change: 1 addition & 0 deletions serverless/discover/snippets
1 change: 1 addition & 0 deletions serverless/install/snippets
1 change: 1 addition & 0 deletions serverless/integrations/snippets
1 change: 1 addition & 0 deletions serverless/security/snippets
16 changes: 16 additions & 0 deletions snippets/routing-odc.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Text snippet included in the following modules:
//
// * modules/odc-importing-codebase-from-git-to-create-application.adoc

:_content-type: SNIPPET

Routing:: By clicking the *Routing* link, you can perform the following actions:
* Customize the hostname for the route.
* Specify the path the router watches.
* Select the target port for the traffic from the drop-down list.
* Secure your route by selecting the *Secure Route* check box. Select the required TLS termination type and set a policy for insecure traffic from the respective drop-down lists.
+
[NOTE]
====
For serverless applications, the Knative service manages all the routing options above. However, you can customize the target port for traffic, if required. If the target port is not specified, the default port of `8080` is used.
====
16 changes: 16 additions & 0 deletions snippets/scaling-odc.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Text snippet included in the following modules:
//
// * modules/odc-importing-codebase-from-git-to-create-application.adoc

:_content-type: SNIPPET

Scaling:: Click the *Scaling* link to define the number of pods or instances of the application you want to deploy initially.
+
If you are creating a serverless deployment, you can also configure the following settings:
+
* *Min Pods* determines the lower limit for the number of pods that must be running at any given time for a Knative service. This is also known as the `minScale` setting.
* *Max Pods* determines the upper limit for the number of pods that can be running at any given time for a Knative service. This is also known as the `maxScale` setting.
* *Concurrency target* determines the number of concurrent requests desired for each instance of the application at a given time.
* *Concurrency limit* determines the limit for the number of concurrent requests allowed for each instance of the application at a given time.
* *Concurrency utilization* determines the percentage of the concurrent requests limit that must be met before Knative scales up additional pods to handle additional traffic.
* *Autoscale window* defines the time window over which metrics are averaged to provide input for scaling decisions when the autoscaler is not in panic mode. A service is scaled-to-zero if no requests are received during this window. The default duration for the autoscale window is `60s`. This is also known as the stable window.
11 changes: 11 additions & 0 deletions snippets/serverless-domain-mapping-odc.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Text snippet included in the following modules:
//
// * modules/odc-importing-codebase-from-git-to-create-application.adoc

:_content-type: SNIPPET

Domain mapping:: If you are creating a *Serverless Deployment*, you can add a custom domain mapping to the Knative service during creation.
+
* In the *Advanced options* section, click *Show advanced Routing options*.
** If the domain mapping CR that you want to map to the service already exists, you can select it from the *Domain mapping* drop-down menu.
** If you want to create a new domain mapping CR, type the domain name into the box, and select the *Create* option. For example, if you type in `example.com`, the *Create* option is *Create "example.com"*.