Closed anna-geller closed 2 months ago
Better to go for the long-term one since allowedNamespace is now added :+1: Dumb question but I'm wondering about the interest of keeping namespace variables (aside from compatibility reasons) ?
EDIT: since KV mandate JSON values it seems that's the reason why but for new users I guess variables don't add much and won't be used
Yes, the short term version is no longer relevant
You're right that we still need to figure out the format for the values, I'm still not sure whether the entire value should be mandated to always be JSON instead of e.g. supporting simple strings too - TBD
the kestra's database only contains metadata about it, such as the key, file URI, any attached metadata about this object, TTL, creation date, last updated timestamp, etc.
Can we consider leveraging custom metadata from storages directly on stored objects instead of splitting the implementation across both DB and storage ? There is only an issue with LocalStorage as it's purely file-system based we can't have such mecanism :/
Another subject: when you talk about namespace binding, do you also speak in term of permission ? Should I tie the read create delete update to the NAMESPACE permission ?
Can we consider leveraging custom metadata from storages directly on stored objects instead of splitting the implementation across both DB and storage ? There is only an issue with LocalStorage as it's purely file-system based we can't have such mecanism :/
Yes, it could be convenient for other usages. For the LocalStorage, you can for ex have a file.extension.metadata file with the information in it.
The only painpoint is when listing KVs we will need to read every metadata file but we can be ok with the fact that it won't be as performant
@anna-geller For this task to be successfully implemented to OSS, we need a way for our users to open a single namespace in the UI, and that is the namespace listing we overhauled for the EE version.
But, tricky part there is that we also need to handle NS end points on the BE, as well. Do we want to use this issue or open another one for backend?
Milos, always feel free to create new issues if it makes things easier for you
Feature description
The key value store will be implemented on top of internal storage for the following reasons:
Keys and values
Keys
are arbitrary stringsValues
are stored as ION files in internal storage.Thanks to ION, we can support strong types (as with inputs): datetime, int, float, string, FILE type etc.
Namespace binding
Key value pairs are tied to a
namespace
.Users should be able to create and read KV pairs across namespaces as long as those namespaces are allowed https://github.com/kestra-io/kestra-ee/issues/1099.
Namespace management in OSS
To enable namespace binding in the OSS edition, we’ll introduce a lightweight version of Namespace Management (currently available only in EE) to the open-source edition, including:
All other tabs will be greyed out with a hint that they are available on EE if the user needs them.
KV Store UI
The UI for KV will look a lot like the Secrets UI with a button at the top to create a new KV pair
“New KV pair”
https://www.figma.com/file/ew0uXk0NRXJ2NBBJTNe2n1/UI?type=design&node-id=1456%3A18323&mode=design&t=Wm5ld1tT8VcTcGL9-1
You can Create, Read, Update or Delete KV pairs using:
namespace_kv
KV Store core plugin
Set (or modify) a KV pair
Get a KV pair
The easiest way to retrieve a value by key is to use the Pebble function following this syntax:
If you prefer, you can also retrieve the value using a task:
And if you want to check if some values already exist for a given key, you can search keys by prefix:
The output will be a list of keys—if no keys were found, an empty list will be returned.
Delete a KV pair
On EE, we need dedicated permission (might be called
KVSTORE
) to allow fine-granular access to create, read, update or delete KV pairs on specific namespaces.Extra notes
ttl
will be lazily evaluated, i.e., only if the user tries to retrieve the value and the value is past its TTL, the key will be deleted, and we'll return null + a friendly message clarifying the expiration of the key.Purge
task cannot be used to purge old keys as Purge is tied to executions. We'll need to add a new task, e.g.,PurgeKV
, to support purging expired keys (or all keys past a certain creation date if needed).Extra context
Why not just use State Store?
State Store ist challenging to use. Common issues include:
Being able to set the type for that saved valuePotentially also being able to react to changes in the state store as a simple decoupling mechanismUse cases
Use cases this will enable: