Skip to content

Commit 8f73c82

Browse files
committed
Adds a test function that can be created using kubectl
based on vmware-archive/kubeless#232
1 parent f7a924a commit 8f73c82

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This is basically https://github.com/kubeless/kubeless/blob/master/examples/nodejs/helloevent.js
2+
# created through:
3+
# ./kubeless function deploy helloevent --from-file helloevent.js --handler hello.handler --runtime nodejs8 --trigger-topic test-basic-with-kafkacat
4+
5+
# Uses the topic from ../test/basic-with-kafkacat.yml,
6+
# which means it gets triggered every 10 seconds by the publisher there
7+
8+
# See output:
9+
# kubectl -n default logs -lfunction=kubeless-test-function
10+
# Check for validation errors after create:
11+
# kubectl -n kubeless logs -lkubeless=controller --since=60s
12+
13+
---
14+
apiVersion: k8s.io/v1
15+
kind: Function
16+
metadata:
17+
name: kubeless-test-function
18+
namespace: default
19+
spec:
20+
handler: hello.handler
21+
runtime: nodejs8
22+
type: PubSub
23+
topic: test-basic-with-kafkacat
24+
function: |-
25+
module.exports = {
26+
handler: (context) => {
27+
console.log('Serverless at', new Date().toUTCString(), 'with message:', context);
28+
}
29+
};

0 commit comments

Comments
 (0)