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 @@ -2,6 +2,7 @@
[id="odc-creating-applications-using-developer-perspective"]
= Creating applications using the Developer perspective
include::modules/common-attributes.adoc[]
include::modules/serverless-document-attributes.adoc[]
:context: odc-creating-applications-using-developer-perspective

toc::[]
Expand All @@ -18,7 +19,7 @@ The *Developer* perspective in the web console provides you the following option
* *Helm Chart*: Explore the *Developer Catalog* to select the required Helm chart to simplify deployment of applications and services.

ifdef::openshift-enterprise,openshift-webscale[]
Note that certain options, such as *Pipelines*, *Event Source*, and *Import Virtual Machines*, are displayed only when the xref:../../pipelines/installing-pipelines.adoc#op-installing-pipelines-operator-in-web-console_installing-pipelines[OpenShift Pipelines Operator], xref:../../serverless/install/install-serverless-operator.adoc#serverless-install-web-console_install-serverless-operator[OpenShift Serverless Operator], and xref:../../virt/install/installing-virt-web.adoc#virt-subscribing-to-the-catalog_installing-virt-web[OpenShift Virtualization Operator] are installed, respectively.
Note that certain options, such as *Pipelines*, *Event Source*, and *Import Virtual Machines*, are displayed only when the xref:../../pipelines/installing-pipelines.adoc#op-installing-pipelines-operator-in-web-console_installing-pipelines[OpenShift Pipelines Operator], xref:../../serverless/install/install-serverless-operator.adoc#serverless-install-web-console_install-serverless-operator[{ServerlessOperatorName}], and xref:../../virt/install/installing-virt-web.adoc#virt-subscribing-to-the-catalog_installing-virt-web[OpenShift Virtualization Operator] are installed, respectively.
endif::[]

[id="prerequisites_odc-creating-applications-using-developer-perspective"]
Expand All @@ -34,11 +35,20 @@ ifdef::openshift-enterprise,openshift-webscale[]

To create serverless applications, in addition to the preceding prerequisites, ensure that:

* You have xref:../../serverless/install/install-serverless-operator.adoc#install-serverless-operator[installed the OpenShift Serverless Operator].
* You have xref:../../serverless/install/install-serverless-operator.adoc#install-serverless-operator[installed the {ServerlessOperatorName}].
* You have xref:../../serverless/install/installing-knative-serving.adoc#installing-knative-serving[created a `KnativeServing` resource in the `knative-serving` namespace].

endif::[]

include::modules/odc-creating-sample-applications.adoc[leveloffset=+1]

include::modules/odc-importing-codebase-from-git-to-create-application.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 Knative autoscaling settings for {ServerlessProductName}, see xref:../../serverless/develop/serverless-autoscaling-developer.adoc#serverless-autoscaling-developer[Autoscaling].

* For 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].
2 changes: 1 addition & 1 deletion applications/application_life_cycle_management/snippets
19 changes: 2 additions & 17 deletions modules/odc-importing-codebase-from-git-to-create-application.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,7 @@ The *Knative Service* option is displayed in the *Import from git* form only if
. In the *Advanced Options* section, the *Create a route to the application* is selected by default so that you can access your application using a publicly available URL. You can clear the check box if you do not want to expose your application on a public route.
. 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.
include::snippets/routing-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 @@ -66,20 +59,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.

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.
====
13 changes: 13 additions & 0 deletions snippets/scaling-odc.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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 Knative service, you can also configure the following settings:
+
* 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.