Skip to content

Commit

Permalink
change alpha1 to alpha2 in AC and Eventing tutorials (#16989)
Browse files Browse the repository at this point in the history
* change alpha1 to alpha2 in tutorials

* change Function code in Event name clean

* remove unnecessarry line

* change Function code in Changing event max

* Apply suggestions from anoipm review

Co-authored-by: Marcin Dobrochowski <39153236+anoipm@users.noreply.github.com>

---------

Co-authored-by: Marcin Dobrochowski <39153236+anoipm@users.noreply.github.com>
  • Loading branch information
grego952 and anoipm authored Mar 8, 2023
1 parent fde740a commit 060c16e
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ spec:
region: "us"
services: {LIST_OF_REGISTERED_SERVICES}
```
**TIP:** You can use Kyma Dashboard to create and manage your Application. To do so, go to **Integration > Applications** from the **Cluster Details** view.
>**TIP:** You can use Kyma Dashboard to create and manage your Application. To do so, go to **Integration > Applications** from the **Cluster Details** view.
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,47 @@ This guide shows how to call a registered external service from Kyma using a sim

```bash
cat <<EOF | kubectl apply -f -
apiVersion: serverless.kyma-project.io/v1alpha1
apiVersion: serverless.kyma-project.io/v1alpha2
kind: Function
metadata:
name: $FUNCTION_NAME
namespace: $NAMESPACE
labels:
app: $APP_NAME
spec:
deps: |-
{
"name": "example-1",
"version": "0.0.1",
"dependencies": {
"request": "^2.85.0"
}
}
source: |-
const request = require('request');
module.exports = { main: function (event, context) {
runtime: nodejs16
source:
inline:
source: |-
const request = require('request');
module.exports = { main: function (event, context) {
return new Promise((resolve, reject) => {
const url = process.env.GATEWAY_URL + "/uuid";
const options = {
url: url,
};
sendReq(url, resolve, reject)
})
} }
function sendReq(url, resolve, reject) {
} }
function sendReq(url, resolve, reject) {
request.get(url, { json: true }, (error, response, body) => {
if(error){
resolve(error);
}
resolve(response.body);
})
}
}
dependencies: |-
{
"name": "example-1",
"version": "0.0.1",
"dependencies": {
"request": "^2.85.0"
}
}
env:
- name: GATEWAY_URL
value: $GATEWAY_URL
Expand Down
44 changes: 23 additions & 21 deletions docs/03-tutorials/00-eventing/evnt-03-type-cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,31 @@ You learn how Eventing behaves when you create a [Subscription](../../05-technic

```bash
cat <<EOF | kubectl apply -f -
apiVersion: serverless.kyma-project.io/v1alpha1
kind: Function
metadata:
labels:
serverless.kyma-project.io/build-resources-preset: local-dev
serverless.kyma-project.io/function-resources-preset: S
serverless.kyma-project.io/replicas-preset: S
name: lastorder
namespace: default
spec:
deps: '{ "dependencies": {}}'
maxReplicas: 1
minReplicas: 1
source: |
module.exports = {
main: async function (event, context) {
console.log("Received event: ", event.data, ", Event Type: ", event.extensions.request.headers['ce-type']);
return;
}
}
apiVersion: serverless.kyma-project.io/v1alpha2
kind: Function
metadata:
name: lastorder
namespace: default
spec:
replicas: 1
resourceConfiguration:
function:
profile: S
build:
profile: local-dev
runtime: nodejs16
source:
inline:
source: |-
module.exports = {
main: async function (event, context) {
console.log("Received event: ", event.data, ", Event Type: ", event.extensions.request.headers['ce-type']);
return;
}
}
EOF
```

</details>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,31 @@ The "in-flight messages" config defines the number of events that Kyma Eventing

```bash
cat <<EOF | kubectl apply -f -
apiVersion: serverless.kyma-project.io/v1alpha1
kind: Function
metadata:
labels:
serverless.kyma-project.io/build-resources-preset: local-dev
serverless.kyma-project.io/function-resources-preset: S
serverless.kyma-project.io/replicas-preset: S
name: lastorder
namespace: default
spec:
deps: '{ "dependencies": {}}'
maxReplicas: 1
minReplicas: 1
source: |
module.exports = {
main: async function (event, context) {
console.log("Processing event:", event.data);
// sleep/wait for 5 seconds
await new Promise(r => setTimeout(r, 5 * 1000));
console.log("Completely processed event:", event.data);
return;
}
}
apiVersion: serverless.kyma-project.io/v1alpha2
kind: Function
metadata:
name: lastorder
namespace: default
spec:
replicas: 1
resourceConfiguration:
function:
profile: S
build:
profile: local-dev
runtime: nodejs16
source:
inline:
source: |-
module.exports = {
main: async function (event, context) {
console.log("Processing event:", event.data);
// sleep/wait for 5 seconds
await new Promise(r => setTimeout(r, 5 * 1000));
console.log("Completely processed event:", event.data);
return;
}
}
EOF
```

Expand Down

0 comments on commit 060c16e

Please sign in to comment.