-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathserverless-application-quickstart.yaml
216 lines (166 loc) · 11.2 KB
/
serverless-application-quickstart.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
apiVersion: console.openshift.io/v1
kind: ConsoleQuickStart
metadata:
name: serverless-application
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+LmNscy0xe2ZpbGw6I2UwMzQwMDt9LmNscy0ye2ZpbGw6I2NlMmUwMDt9LmNscy0ze2ZpbGw6bm9uZTt9LmNscy00e2ZpbGw6I2ZmZjt9LmNscy01e2ZpbGw6I2RjZGNkYzt9LmNscy02e2ZpbGw6I2FhYTt9PC9zdHlsZT48L2R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wMSIvPjxjaXJjbGUgY2xhc3M9ImNscy00IiBjeD0iMzEuMDkiIGN5PSIzMy4xIiByPSIzLjAxIi8+PGNpcmNsZSBjbGFzcz0iY2xzLTQiIGN4PSI2OC44OSIgY3k9IjMzLjEiIHI9IjMuMDEiLz48L3N2Zz4=
introduction: >-
This quick start guides you through creating and using a serverless
application.
nextQuickStart:
- ""
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/__OCP_TARGET__/applications/odc-viewing-application-composition-using-topology-view.html)
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/__OCP_TARGET__/applications/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 accommodate 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**. This loads the Event Source Catalog.
4. From the Event Source Catalog, select **PingSource** and then **Create Event Source**.
5. An Event Source form will load. 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. (Optional) Add your **PingSource** to an application by selecting one from the **Application**
dropdown or creating one by selecting **Create Application**.
8. Click **Create**.
review:
failedTaskHelp: >-
This task isn’t verified yet. Try the task again, or [read
more](https://docs.openshift.com/container-platform/__OCP_TARGET__/serverless/eventing/event-sources/serverless-pingsource.html#serverless-pingsource-odc_serverless-pingsource)
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/__OCP_TARGET__/serverless/knative-serving/traffic-splitting/traffic-splitting-revisions.html#odc-splitting-traffic-between-revisions-using-developer-perspective_traffic-splitting-revisions)
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/__OCP_TARGET__/applications/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