ekuiper icon indicating copy to clipboard operation
ekuiper copied to clipboard

Support for file-based rule & stream provisioning on startup

Open tonyespy opened this issue 3 years ago • 5 comments

It would be useful if Kuiper supported file-based rule and stream provisioning (i.e. importing) on startup. Currently rules and streams need to be created by someone using the client, or an application requesting creation via the Kuiper REST API.

Supporting file-based provisioning would allow someone to deploy Kuiper with a pre-defined set of streams and rules, removing the need for someone (or some application) to create them.

EdgeX uses this concept for device services, which support provisioning of devices and device profiles via static YAML files read by the service on startup from a pre-defined directories (configurable).

tonyespy avatar Aug 24 '21 18:08 tonyespy

Hi. May I have a try on it. Are there any advice for implementation.

wfnuser avatar Aug 30 '21 06:08 wfnuser

@wfnuser This is basically a copy of tools/kubernetes except that it only runs once. You can try to migrate our k8s tool to run at kuiperd server startup

ngjaying avatar Aug 30 '21 07:08 ngjaying

@wfnuser This is basically a copy of tools/kubernetes except that it only runs once. You can try to migrate our k8s tool to run at kuiperd server startup

Cool. Let me try it.

wfnuser avatar Aug 31 '21 08:08 wfnuser

@ngjaying

My original idea was that rules and streams would be handled the same way sinks and sources are, namely on startup, kuiper would read them from the appropriate directories (e.g. /etc/rules, /etc/streams). Sorry for leaving that out!

The approach you're suggesting essentially uses a k8s helper application to read JSON from a file which provides enough information to construct kuiper REST requests, which can then be used to create rules and streams.

I think we could accomplish the same thing by just using the kuiper client right? The only thing I'm not sure about is whether or not the create stream command supports reading from a file (e.g. -f)?

tonyespy avatar Sep 03 '21 22:09 tonyespy

@tonyespy This issue aims to support your original idea which wll not need a helper applications after it is implemented.

The kuiper CLI client do supporte -f to specify a file for stream/rule. Please check CLI create a stream

ngjaying avatar Sep 06 '21 00:09 ngjaying