diff --git a/_topic_map.yml b/_topic_map.yml index ac9bb7fa98..077beb9a4f 100644 --- a/_topic_map.yml +++ b/_topic_map.yml @@ -1658,6 +1658,12 @@ Topics: File: installing-kn - Name: Removing OpenShift Serverless File: removing-openshift-serverless +# Apps +- Name: Creating and managing serverless applications + File: serving-creating-managing-apps +# HA +- Name: Configuring high-availability components + File: serverless-config-HA # Knative CLI - Name: Knative CLI Dir: knative_cli @@ -1670,10 +1676,7 @@ Topics: Topics: - Name: How Knative Serving works File: serverless-knative-serving - - Name: Getting started with Knative services - File: getting-started-knative-services - - Name: Creating serverless applications - File: creating-serverless-applications + ### Knative services - Name: Interacting with serverless applications File: interacting-serverless-apps - Name: Configuring Knative Serving autoscaling @@ -1706,9 +1709,6 @@ Topics: # Channels - Name: Using channels File: serverless-channels -# HA -- Name: Configuring high-availability components - File: serverless-config-HA # Metering - Name: Using metering with OpenShift Serverless File: serverless-metering diff --git a/applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc b/applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc index 5120dfaa2d..aa3ac6e34a 100644 --- a/applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc +++ b/applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc @@ -19,7 +19,7 @@ image::odc_add_view.png[Add View] ifdef::openshift-enterprise,openshift-webscale,openshift-origin[] [NOTE] ==== -The serverless sections in the above options are displayed only if the xref:../../serverless/installing_serverless/installing-openshift-serverless.adoc#installing-openshift-serverless[*Serverless Operator*] is installed in your cluster. OpenShift Serverless is a Technology Preview feature. +Serverless options in the *Developer* perspective are displayed only if the xref:../../serverless/installing_serverless/installing-openshift-serverless.adoc#serverless-install-web-console_installing-openshift-serverless[*OpenShift Serverless Operator*] is installed in your cluster. ==== endif::[] @@ -32,7 +32,7 @@ To create applications using the *Developer* perspective ensure that: ifdef::openshift-enterprise,openshift-webscale,openshift-origin[] -To create serverless applications, in addition to the above, ensure that: +To create serverless applications, in addition to the preceeding prerequisites, ensure that: * You have xref:../../serverless/installing_serverless/installing-openshift-serverless.adoc#installing-openshift-serverless[installed the Openshift Serverless Operator]. * You have xref:../../serverless/installing_serverless/installing-knative-serving.adoc#installing-knative-serving[created a knative-serving namespace and a KnativeServing resource in the knative-serving namespace]. diff --git a/images/add-serverless-app-dev.png b/images/add-serverless-app-dev.png new file mode 100644 index 0000000000..1e69d3206d Binary files /dev/null and b/images/add-serverless-app-dev.png differ diff --git a/images/serverless-create-service-admin.png b/images/serverless-create-service-admin.png new file mode 100644 index 0000000000..b3c99c8ef1 Binary files /dev/null and b/images/serverless-create-service-admin.png differ diff --git a/images/service-yaml-admin.png b/images/service-yaml-admin.png new file mode 100644 index 0000000000..28823e44a0 Binary files /dev/null and b/images/service-yaml-admin.png differ diff --git a/modules/creating-knative-services.adoc b/modules/creating-knative-services.adoc deleted file mode 100644 index 95669ece2a..0000000000 --- a/modules/creating-knative-services.adoc +++ /dev/null @@ -1,33 +0,0 @@ -// Module included in the following assemblies: -// -// * serverless/getting-started-knative-services.adoc - -[id="creating-knative-services_{context}"] -= Creating a Knative service - -To create a service, you must create the `service.yaml` file. - -You can copy the sample below. This sample will create a sample golang application called `helloworld-go` and allows you to specify the image for that application. - -[source,yaml] ----- -apiVersion: serving.knative.dev/v1alpha1 <1> -kind: Service -metadata: - name: helloworld-go <2> - namespace: default <3> -spec: - template: - spec: - containers: - - image: gcr.io/knative-samples/helloworld-go <4> - env: - - name: TARGET <5> - value: "Go Sample v1" ----- - -<1> Current version of Knative -<2> The name of the application -<3> The namespace the application will use -<4> The URL to the image of the application -<5> The environment variable printed out by the sample application diff --git a/modules/creating-serverless-apps-admin-console.adoc b/modules/creating-serverless-apps-admin-console.adoc new file mode 100644 index 0000000000..77589525d1 --- /dev/null +++ b/modules/creating-serverless-apps-admin-console.adoc @@ -0,0 +1,23 @@ +// Module included in the following assemblies: +// +// serverless/serving-creating-managing-apps.adoc + +[id="creating-serverless-apps-admin-console_{context}"] += Creating serverless applications using the Administrator perspective + +.Prerequisites +To create serverless applications using the *Administrator* perspective, ensure that you have completed the following steps. + +* The {ServerlessOperatorName} and Knative Serving are installed. +* You have logged in to the web console and are in the *Administrator* perspective. + +.Procedure + +. Navigate to the *Serverless* → *Services* page. ++ +image::serverless-create-service-admin.png[Services page] +. Click *Create Service*. +. Manually enter YAML or JSON definitions, or by dragging and dropping a file into the editor. ++ +image::service-yaml-admin.png[Text editor] +. Click *Create*. diff --git a/modules/creating-serverless-apps-kn.adoc b/modules/creating-serverless-apps-kn.adoc new file mode 100644 index 0000000000..e00bb10c23 --- /dev/null +++ b/modules/creating-serverless-apps-kn.adoc @@ -0,0 +1,35 @@ +// Module included in the following assemblies: +// +// serverless/serving-creating-managing-apps.adoc + +[id="creating-serverless-apps-kn_{context}"] += Creating serverless applications using the kn CLI + +.Prerequisites +* You have installed the {ServerlessOperatorName} and Knative Serving. +* You have installed `kn` CLI. + +.Procedure + +. Create the Knative service by entering the following command: ++ +---- +$ kn service create --image --env +---- ++ +.Example ++ +---- +$ kn service create hello --image gcr.io/knative-samples/helloworld-go --env TARGET=Knative + +Creating service 'hello' in namespace 'default': + + 0.271s The Route is still working to reflect the latest desired specification. + 0.580s Configuration "hello" is waiting for a Revision to become ready. + 3.857s ... + 3.861s Ingress has not yet been reconciled. + 4.270s Ready to serve. + +Service 'hello' created with latest revision 'hello-bxshg-1' and URL: +http://hello-default.apps-crc.testing +---- diff --git a/modules/creating-serverless-apps-yaml.adoc b/modules/creating-serverless-apps-yaml.adoc new file mode 100644 index 0000000000..af722fa22f --- /dev/null +++ b/modules/creating-serverless-apps-yaml.adoc @@ -0,0 +1,43 @@ +// Module included in the following assemblies: +// +// serverless/serving-creating-managing-apps.adoc + +[id="creating-serverless-apps-yaml_{context}"] += Creating serverless applications using YAML + +To create a serverless application, you can create a YAML file and apply it using `oc apply`. + +You can create a YAML file by copying the following example: + +.Example Knative service YAML +[source,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 + env: + - name: TARGET + value: "Go Sample v1" +---- + +In this example, the YAML file is named `hello-service.yaml`. + +.Procedure + +. Navigate to the directory where the `hello-service.yaml` file is contained. +. Deploy the application by applying the YAML file. ++ +---- +$ oc apply --filename hello-service.yaml +---- + +After the service has been created and the application has been deployed, Knative will create a new immutable revision for this version of the application. + +Knative will also perform network programming to create a route, ingress, service, and load balancer for your application, and will automatically scale your pods up and down based on traffic, including inactive Pods. diff --git a/modules/deploying-serverless-apps.adoc b/modules/deploying-serverless-apps.adoc deleted file mode 100644 index 88d3ceca99..0000000000 --- a/modules/deploying-serverless-apps.adoc +++ /dev/null @@ -1,22 +0,0 @@ -// Module included in the following assemblies: -// -// * serverless/getting-started-knative-services.adoc - -[id="deploying-serverless-apps_{context}"] -= Deploying a serverless application - -To deploy a serverless application, you must apply the `service.yaml` file. - -.Procedure - -. Navigate to the directory where the `service.yaml` file is contained. -. Deploy the application by applying the `service.yaml` file. -+ ----- -$ oc apply --filename service.yaml ----- - -Now that service has been created and the application has been deployed, Knative will create a new immutable revision for this version of the application. -// TODO: Add docs about revisions - -Knative will also perform network programming to create a route, ingress, service, and load balancer for your application, and will automatically scale your pods up and down based on traffic, including inactive pods. diff --git a/modules/knative-services-connectivity.adoc b/modules/knative-services-connectivity.adoc deleted file mode 100644 index aea6187449..0000000000 --- a/modules/knative-services-connectivity.adoc +++ /dev/null @@ -1,19 +0,0 @@ -// Module included in the following assemblies: -// -// * serverless/getting-started-knative-services.adoc - -[id="knative-services-connectivity_{context}"] -= Connecting Knative Services to existing Kubernetes deployments - -Knative Services can call a Kubernetes deployment in any namespace, provided that there are no existing additional network barriers. - -A Kubernetes deployment can call a Knative Service if: - -* The Kubernetes deployment is in the same namespace as the target Knative Service. -* The Kubernetes deployment is in a namespace that was manually added to the ServiceMeshMemberRoll in `knative-serving-ingress`. -* The Kubernetes deployment uses the target Knative Service's public URL. -+ -[NOTE] -==== -Knative Services are accessed using a public URL by default. The target Knative Service must not be configured as a private, `cluster-local` visibility service if you want to connect it to your existing Kubernetes deploying using a public URL. -==== diff --git a/modules/odc-importing-codebase-from-git-to-create-application.adoc b/modules/odc-importing-codebase-from-git-to-create-application.adoc index 0ae3c28f78..f03d7fc2c9 100644 --- a/modules/odc-importing-codebase-from-git-to-create-application.adoc +++ b/modules/odc-importing-codebase-from-git-to-create-application.adoc @@ -1,7 +1,6 @@ // Module included in the following assemblies: // // applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc -//serverless/creating-serverless-applications.adoc [id="odc-importing-codebase-from-git-to-create-application_{context}"] = Importing a codebase from Git to create an application diff --git a/modules/serverless-apps-intro.adoc b/modules/serverless-apps-intro.adoc new file mode 100644 index 0000000000..ea2fa69a10 --- /dev/null +++ b/modules/serverless-apps-intro.adoc @@ -0,0 +1,39 @@ +// Module is included in the following assemblies: +// +// serverless/knative_serving/serverless-knative-serving.adoc +// serverless/serving-creating-managing-apps.adoc + +[id="serverless-about-services_{context}"] += Serverless applications using Knative services + +To deploy a serverless application using {ServerlessProductName}, you must create a _Knative service_. +Knative services are Kubernetes services, defined by a route and a configuration, and contained in a YAML file. + +.Example Knative service YAML +[source,yaml] +---- +apiVersion: serving.knative.dev/v1 +kind: Service +metadata: + name: helloworld-go <1> + namespace: default <2> +spec: + template: + spec: + containers: + - image: gcr.io/knative-samples/helloworld-go <3> + env: + - name: TARGET <4> + value: "Go Sample v1" +---- + +<1> The name of the application. +<2> The namespace the application will use. +<3> The image of the application. +<4> The environment variable printed out by the sample application. + +You can create a serverless application by using one of the following methods: + +* Create a Knative service from the {product-title} web console. +* Create a Knative service using the `kn` CLI. +* Create and apply a YAML file. diff --git a/serverless/knative_serving/creating-serverless-applications.adoc b/serverless/knative_serving/creating-serverless-applications.adoc deleted file mode 100644 index c26353346d..0000000000 --- a/serverless/knative_serving/creating-serverless-applications.adoc +++ /dev/null @@ -1,20 +0,0 @@ -[id="creating-serverless-applications"] -= Creating serverless applications -include::modules/common-attributes.adoc[] -include::modules/serverless-document-attributes.adoc[] -:context: creating-serverless-applications - -// To Do: modules/serverless-creating-serverless-applications-using-cli.adoc[leveloffset=+1] - -You can create serverless applications by using the *Developer* perspective in the {product-title} web console. - -.Prerequisites -To create serverless applications using the *Developer* perspective ensure that: - -* You have xref:../../web_console/web-console.adoc#web-console[logged in to the web console]. -* You are in the xref:../../web_console/odc-about-developer-perspective.adoc#odc-about-developer-perspective[*Developer* perspective]. -* You have the appropriate xref:../../authentication/using-rbac.adoc#default-roles_using-rbac[roles and permissions] in a project to create applications and other workloads in {product-title}. -* You have xref:../installing_serverless/installing-openshift-serverless.adoc#installing-openshift-serverless[installed the Openshift Serverless Operator]. -* You have xref:../installing_serverless/installing-knative-serving.adoc#installing-knative-serving[created a knative-serving namespace and a KnativeServing resource in the knative-serving namespace]. - -include::modules/odc-importing-codebase-from-git-to-create-application.adoc[leveloffset=+1] diff --git a/serverless/knative_serving/getting-started-knative-services.adoc b/serverless/knative_serving/getting-started-knative-services.adoc deleted file mode 100644 index 833503c9e8..0000000000 --- a/serverless/knative_serving/getting-started-knative-services.adoc +++ /dev/null @@ -1,13 +0,0 @@ -[id="getting-started-knative-services"] -= Getting started with Knative services -include::modules/common-attributes.adoc[] -include::modules/serverless-document-attributes.adoc[] -:context: getting-started-knative-services - -toc::[] - -Knative services are Kubernetes services that a user creates to deploy a serverless application. Each Knative service is defined by a route and a configuration, contained in a `.yaml` file. - -include::modules/creating-knative-services.adoc[leveloffset=+1] -include::modules/deploying-serverless-apps.adoc[leveloffset=+1] -include::modules/knative-services-connectivity.adoc[leveloffset=+1] diff --git a/serverless/knative_serving/serverless-knative-serving.adoc b/serverless/knative_serving/serverless-knative-serving.adoc index 8d22260069..b39b7b99a9 100644 --- a/serverless/knative_serving/serverless-knative-serving.adoc +++ b/serverless/knative_serving/serverless-knative-serving.adoc @@ -17,3 +17,7 @@ These CRDs are building blocks to address complex use cases, for example: * Viewing point-in-time snapshots of deployed code and configurations. include::modules/serverless-serving-resources.adoc[leveloffset=+1] +include::modules/serverless-apps-intro.adoc[leveloffset=+1] + +== Next steps +* Create a serverless application. For more information, see the documentation on xref:../../serverless/serving-creating-managing-apps.adoc#serving-creating-managing-apps[Creating and managing serverless applications]. diff --git a/serverless/serving-creating-managing-apps.adoc b/serverless/serving-creating-managing-apps.adoc new file mode 100644 index 0000000000..77005b03fb --- /dev/null +++ b/serverless/serving-creating-managing-apps.adoc @@ -0,0 +1,22 @@ +include::modules/serverless-document-attributes.adoc[] +[id="serving-creating-managing-apps"] += Creating and managing serverless applications +include::modules/common-attributes.adoc[] +:context: serving-creating-managing-apps + +toc::[] + +include::modules/serverless-apps-intro.adoc[leveloffset=+1] + +== Creating serverless applications using the {product-title} web console + +You can create a serverless application using either the *Developer* or *Administrator* perspective in the {product-title} web console. + +include::modules/creating-serverless-apps-admin-console.adoc[leveloffset=+2] + +=== Creating serverless applications using the Developer perspective + +For more information about creating applications using the *Developer* perspective in {product-title}, see the documentation on xref:../applications/application_life_cycle_management/odc-creating-applications-using-developer-perspective.adoc#odc-creating-applications-using-developer-perspective[Creating applications using the Developer perspective]. + +include::modules/creating-serverless-apps-kn.adoc[leveloffset=+1] +include::modules/creating-serverless-apps-yaml.adoc[leveloffset=+1]