apiVersion: console.openshift.io/v1
kind: ConsoleQuickStart
metadata:
  creationTimestamp: '2020-12-07T19:35:37Z'
  generation: 6
  managedFields:
    - apiVersion: console.openshift.io/v1
      fieldsType: FieldsV1
      fieldsV1:
        'f:spec':
          .: {}
          'f:conclusion': {}
          'f:description': {}
          'f:displayName': {}
          'f:durationMinutes': {}
          'f:icon': {}
          'f:introduction': {}
          'f:nextQuickStart': {}
          'f:prerequisites': {}
          'f:tasks': {}
      manager: Mozilla
      operation: Update
      time: '2020-12-07T21:06:14Z'
  name: serverless-application
  resourceVersion: '163279'
  selfLink: /apis/console.openshift.io/v1/consolequickstarts/serverless-application
  uid: c345e522-38e5-4a2e-b428-be63572acec9
spec:
  conclusion: >-
    You just learned how to use Serverless applications in your cluster! To
    learn more about building Serverless apps, take a look at our [Knative
    Cookbook](https://redhat-developer-demos.github.io/knative-tutorial/knative-tutorial/index.html).
  description: Learn how to create a Serverless application.
  displayName: Exploring Serverless applications
  durationMinutes: 15
  icon: >-
    data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2UwMzQwMDt9LmNscy0ye2ZpbGw6I2NlMmUwMDt9LmNscy0ze2ZpbGw6bm9uZTt9LmNscy00e2ZpbGw6I2ZmZjt9LmNscy01e2ZpbGw6I2RjZGNkYzt9LmNscy02e2ZpbGw6I2FhYTt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPlJlZF9IYXQtT3BlbnNoaWZ0NC1DYXRhbG9nX0ljb25zLVNlcnZlcmxlc3M8L3RpdGxlPjxjaXJjbGUgY2xhc3M9ImNscy0xIiBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz48cGF0aCBjbGFzcz0iY2xzLTIiIGQ9Ik04NS4zNiwxNC42NEE1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art:
    - ''
  prerequisites:
    - ''
  tasks:
    - description: >-
        ### To create a serverless application:

        1. From the **Developer** perspective, in the navigation menu, click
        [+Add](/add).

        2. At the top of the page, in the **Projects** list, select a project to
        create the application in. You can also create a new one.

        3. Click **From Git**.

        4. In the **Git Repo URL** field, type
        `https://github.com/sclorg/django-ex.git`.

        5. Under Resources, select **Knative Service**.

        6. At the end of the page, click **Create**.


        The **Topology** view displays your new Serverless application. The
        application is represented by the light gray area with the white border.
        The Knative Service is the darker gray area with the dotted border. The
        Pod ring in the middle represents the revision.
      review:
        failedTaskHelp: >-
          This task isn’t verified yet. Try the task again, or [read
          more](https://docs.openshift.com/container-platform/4.6/serverless/serving-creating-managing-apps.html#creating-serverless-applications-using-the-openshift-container-platform-web-console)
          about this topic.
        instructions: >-
          #### To verify the application was successfully created:

          From the **Topology** view, look for your new application. Wait for
          the build to complete. It may take a few minutes.

          After the build completes, a green checkmark appears in the lower-left
          corner of the service. Your application will say  “No Revisions” in
          the center.

          Do you see the completed application and build?
      summary:
        failed: Try the steps again.
        success: You just created a Serverless app!
      title: Creating a serverless application
    - description: >
        ### To see your application scale:

        1. From the **Display Options** list at the top of the **Topology**
        view, click **Pod Count**.

        2. Wait for the Pod count to scale down to zero Pods. Scaling down may
        take a few minutes.

        3. Click the **Open URL** icon in the upper-right corner of the Knative
        Service panel. The application opens in a new tab.

        4. Close the new browser tab and return to the **Topology** view.

        In the **Topology** view, you can see that your application scaled up to
        one Pod to accommodate your request.  After a few minutes, your
        application scales back down to zero Pods.
      review:
        failedTaskHelp: >-
          This task isn’t verified yet. Try the task again, or [read
          more](https://docs.openshift.com/container-platform/4.6/applications/application_life_cycle_management/odc-viewing-application-composition-using-topology-view.html#odc-scaling-application-pods-and-checking-builds-and-routes_viewing-application-composition-using-topology-view)
          about this topic.
        instructions: >-
          #### To verify the application scaled down:

          1. Click the revision inside your service. The badges under the Pod
          ring and at the top of the side panel should be (REV).

          2. Click the **Details** tab in the side panel.

          Is the Pod ring autoscaled to zero?
      summary:
        failed: Try the steps again.
        success: You just scaled up your application to accomodate a traffic request!
      title: Demoing scalability
    - description: >-
        ### To connect an event source to your Knative Service:

        1. On the **Topology** View, hover over your service with your cursor.
        You should see a blue arrow.

        2. Click and drag the blue arrow, then drop it anywhere outside the
        service.

        3. In the list that appears, click **Event Source**.

        4. Under the **Type** field, click **PingSource**.

        5. In the **Data** field, type `This message is from PingSource`. This
        message is posted when the service is called.

        6. In the **Schedule** field, type `* * * * *`.  This means that the
        PingSource will make a call every minute.

        7. In the **Application** field, select **Sample Serverless App**.

        8. Click **Create**.
      review:
        failedTaskHelp: >-
          This task isn’t verified yet. Try the task again, or [read
          more](https://docs.openshift.com/container-platform/4.6/serverless/event_sources/knative-event-sources.html)
          about this topic.
        instructions: >-
          #### To verify that the event connected to your Knative service:

          Go to the **Topology** view.

          Do you see a PingSource connected by a gray line to the side of your
          application?
      summary:
        failed: Try the steps again.
        success: You just wired an Event Source to your Knative Service!
      title: Connecting an event source to your Knative Service
    - description: >-
        ### To force a revision and set traffic distribution:

        1. In **Topology**, click the revision inside your service to view its
        details. The badges under the Pod ring and at the top of the detail
        panel should be (REV).

        2. In the side panel, click the **Resources** tab.

        3. Scroll down and click the configuration associated with your service.

        4. Go to the resource’s **YAML** tab.

        5. Scroll all the way down until you see `timeoutSeconds`.

        6. Change the value from `300` to `30` and click **Save**.

        7. Go back to the **Topology** view.

        8. Click your service. The badge at the top of the side panel should be
        (KSVC).

        9. In the side panel, click the **Resources** tab.

        10. Next to **Revisions**, click **Set Traffic Distribution**.

        11. Click **Add Revision**.

        12. In the **Revision** dropdown, select the new revision.

        13. In the **Split** column, set both revisions to **50**.

        14. Click **Save**.

        You should now be able to watch as the Pod rings for each revision scale
        up and down each time the application is pinged.
      review:
        failedTaskHelp: >-
          This task isn’t verified yet. Try the task again, or [read
          more](https://docs.openshift.com/container-platform/4.6/serverless/knative_serving/splitting-traffic-between-revisions.html)
          about this topic.
        instructions: >-
          #### To verify that you forced a new revision and set traffic
          distribution:

          Make sure you are still in **Topology** view.

          Do you see two revisions in your Knative Service?
      summary:
        failed: Try the steps again.
        success: You just set a traffic distribution for your Serverless app!
      title: Forcing a new revision and set traffic distribution
    - description: >-
        ### To delete the application you just created:

        1. Click your application’s name. The badge at the top of the side panel
        should be (A).

        2. At the top of the resource details panel, click the **Actions** list.

        3. Click **Delete application**.

        4. To confirm deletion, type the application’s name in the **Name**
        field, and then click **Delete**.
      review:
        failedTaskHelp: >-
          This task is not verified yet. Try the task again, or [read
          more](https://docs.openshift.com/container-platform/4.6/applications/application_life_cycle_management/odc-deleting-applications.html)
          about this topic.
        instructions: |-
          #### To verify you deleted your application:          :
          Make sure you are still in **Topology** view.
          Has the Sample Serverless App been removed?
      summary:
        failed: Try the steps again.
        success: You just deleted your Serverless app!
      title: Deleting your application
