Skip to content

Commit

Permalink
kubeless pubsub
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Aug 30, 2018
1 parent 8195b59 commit f8e5bd6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
22 changes: 22 additions & 0 deletions kubeless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,25 @@ kubeless function call myfunction --data 'This is some data'
kubectl create -f nginx-ingress-controller-with-elb.yml
kubeless trigger http create myfunction --function-name myfunction --hostname myfunction.kubernetes.newtech.academy
```


# PubSub
## Kafka Installation
```
export RELEASE=$(curl -s https://api.github.com/repos/kubeless/kafka-trigger/releases/latest | grep tag_name | cut -d '"' -f 4)
kubectl create -f https://github.com/kubeless/kafka-trigger/releases/download/$RELEASE/kafka-zookeeper-$RELEASE.yaml
```

## Deploy function
```
kubeless function deploy uppercase --runtime nodejs6 \
--dependencies node-example/package.json \
--handler test.uppercase \
--from-file node-example/uppercase.js
```

## Trigger and publish
```
kubeless trigger kafka create test --function-selector created-by=kubeless,function=uppercase --trigger-topic uppercase
kubeless topic publish --topic uppercase --data "this message will be converted to uppercase"
```
7 changes: 7 additions & 0 deletions kubeless/node-example/uppercase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
uppercase: function (event, context) {
str = event['data'].toUpperCase()
console.log(str);
return str
}
}

0 comments on commit f8e5bd6

Please sign in to comment.