Sitemap
siddhi-io

Siddhi is a cloud native, open source, lightweight, stream processing and complex event processing engine.

Siddhi Operator — Deploy App Part 02

--

What is this blog about?

In the previous Part 01 blog, I have discussed how to deploy siddhi apps directly specifying as a string in the custom object YAML file. Here I’m going to discuss how to deploy siddhi apps using K8s config maps. This blog related to siddhi operator version 0.1.0.

Let's go...

First, you need a siddhi file. I saved my siddhi file (Example-Siddhi-App.siddhi) in my desktop.

/Users/buddhi/Desktop/Example-Siddhi-App.siddhi

My sample siddhi file is shown below.

Now I’m creating config map name example-siddhi-app using the above siddhi file to the below kubectl command. You can give any name to the config map according to your requirements.

kubectl create configmap example-siddhi-app --from-file=/Users/buddhi/Desktop/Example-Siddhi-App.siddhi

After that, you need a custom object YAML file as below which having the config map name example-siddhi-app in the apps entry.

The values of the templated siddhi app specified in this yaml file under the env entry like RECEIVER_URL and BASIC_AUTH_ENABLED. Then you can simply install this yaml file as below. My YAML file stored in the path /Users/buddhi/Desktop/example-siddhi-deployment.yaml.

kubectl create -f /Users/buddhi/Desktop/example-siddhi-deployment.yaml

Then it will create deployment, service, and ingress. Now you can use the following POST request to send events to the HTTP source.

curl -X POST \
http://siddhi/example-siddhi-deployment/8280/example \
-H 'Content-Type: application/json' \
-d '{
"type": "monitored",
"deviceID": "001",
"power": 39
}`

Please comment below if you have any questions. You can contribute to siddhi using this GitHub repository.

Notes

You can deploy multiple siddhi apps by specifying multiple config maps under apps entry like below.

apps:
- example-siddhi-app1
- example-siddhi-app2

Moreover, you can create a config map using a directory which contains multiple siddhi files instead of specifying a single siddhi file using the following command. Then you can deploy all siddhi files at once.

kubectl create configmap example-siddhi-apps --from-file=<DIRECTORY_PATH>

Most importantly, you can only use either query entry or apps entry for a single custom object YAML file. Otherwise, siddhi operator gives an error.

--

--

siddhi-io
siddhi-io

Published in siddhi-io

Siddhi is a cloud native, open source, lightweight, stream processing and complex event processing engine.

Buddhi Kothalawala
Buddhi Kothalawala

Written by Buddhi Kothalawala

Try to discover solutions beyond probabilistic Turing machine :D

No responses yet