-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP/Proposal] Flux User Modules #4296
Comments
Partly I'm commenting just to indicate that I've read this. I like the basic design, I'm sure there will be lots of complexity and challenges in the details.
This seems possible to me, and a really neat idea. We could even optionally auto-generate the version number based on some analysis maybe?
|
Do we have a plan to allow for a shared registry so that others can upload code and then use it? Or is the plan for code to be scoped by organization? We would likely abstract this from the Flux engine itself using the dependency subsystem. I see that the API is I'll try to write out a bit more later, but we may want to talk about the various pieces and how they fit together. I'll propose something when I have time to think it over and write it out. |
Long term yes we want what we build today to be sharable to a wider perhaps even global scale. That said its explicitly not a requirement of this initial implementation. My hope/expectation is that we can use this more limited scope implementation to learn what works well and what doesn't before we try to build a fully public registry. |
From a broader product integration perspective... and thinking through the API, CLI, and UI aspects. I would very much like to see the corresponding issues be created and linked to this feature: CLI - provide CRUD commands. leverage the template packager and stacks functionality to ensure that user modules can be packaged and distributed either as standalone entities and/or we can use the community templates repo (or other repos) to provide a Flux shared registry. UI - needs a CRUD page to manage the Flux modules. Modules imported through a template should land here...similarly to the way that dashboards/tasks can be moved around. I would like to see modules allow for labels. This allows a user to provide additional meta data about the module which can be used by the CLI/UI. |
What I am asking for in #23179 is similar to this and perhaps they can share code but what I want are really local packages to help reduce boilerplate and avoid repeating myself (DRY). The idea of a 'registry' and community libraries that you can fetch is interesting, but some of the security considerations are a little scary to me. My thought was to store user-defined functions in packages that are stored in the metadata database, and when you do an 'import' if it's not a standard package it looks there to see if it's a user-defined package. So I think what I was thinking of in #23179 was a whole lot simpler than this but maybe they can leverage big parts of each other's implementations. |
Understood, we intend to build this API as part of the normal product API and then later make it a community features. Meaning that you will first get access to organization scoped packages that only your org can see and use. We intend for the community bits to come later and will likely use the same API but allowing for differences in the fact it would be a public registry. Said another way we tend to design and build a registry, any given registry could be private or public. Our plan is to build and host the private per org registries first and let a community public one come after. |
I'm a big fan of code signing, using either a public chain of trust or Influx Data makes a signing CA. The purpose of that isn't necessarily to verify the code, but to verify the identity of the person who signed to it. So maybe something like that is in the cards. My outstanding concern about your approach is that if I'm an individual developer on maybe InfluxDB oss, I don't want to have to mess with building packages ... I just want to stick a function / package in my local system and I want to be able to easily edit it. Performance wise I don't even care if it's an import or more like an #include. |
Another idea that occurred to me is that there's already a concept of dashboard variables in the UI. The use of those seems to be restricted to just dashboard use. It seems like another possible vector for what I want would be to add a function type (in addition to Query, Map, etc.) then allow those to be persisted in some way that normal query invocation can import them, from any query or task (outside of the UI). |
After some internal discussion here is an updated proposal with more specifics: Flux Modules SpecificationA Flux module is a collection of Flux packages. Module VersionsAll modules will be versioned using a semantic version number Importing ModulesFlux modules are imported using an import statement:
Imports may specify the minimum version of a module that needs to be imported by including a version number like this:
At least version 1.5.6 of the module If a module has a major version of 2 or greater specify the major version of a module like this:
Imports must not specify the major versions for An import may also specify the version
Using
Version ResolutionWhen multiple modules both depend on a specific version of another module the maximum version of the minimum versions is used. For example given the following Flux code
Package Modules APIThe modules API will support the following HTTP paths, this is heavily inspired by the Go proxy API. In the following table, $base is the anchor point of the API, $module is a module path, and $version is a version.
This API has been designed such that it can be served from the filesystem and therefore cached on the filesystem.
ExamplesThe following examples use a $base of
|
I'm generally good with the above API. I think my only qualm would be the pre api. I think we'll need a special api for First, we need a way to publish the pre release version. Second, we need a way to download the zip file for the pre-release version since we'll need to do that to avoid a race condition between hitting the get endpoint and the download endpoint. With that, I propose that we remove I also wonder if we should make some stipulation that |
I’ll have that special API, thanks |
FYI, I took a look at this with my security hat on (cc @nathanielc). Comments in-line
This is excellent. It makes me curious how the implementation will guarantee this, but that is for another day :)
As mentioned elsewhere, this seems to be heavily inspired by Go (fine). Go supports specifying a hash (which gets turned into a pseudo-version). Do you plan to support hashes or exact matches? If not, perhaps it makes sense to update the specification to say this is unsupported.
How will version conflicts be handled? Eg, one specifies 1.2.0 and another 2.0.0? Are both downloaded and used? Is this an error? Something else? Adding this answer to the spec would be nice.
How is authn and authz expected to be done, especially wrt org isolation? Eg, in the short term AIUI modules will be scoped to the org name. In the above, it sounds like the AIUI, later phases of this feature will allow cross-org access to modules. Putting aside discussion on how we deal with bad actors and malware, can you add your thoughts on how this might be done? Is it expanding authz? Adding new metadata to the module for 'public' vs 'private' (ie, org-scoped) where 'public' might simply be GET-able via https:// without authn? Something else? Also, if it is envisioned that
There is great utility in this, but will have to be careful with how this is handled by remote users if they can control |
The implementation of this work is still in-progress see #4296
The implementation of this work is still in-progress see #4296
The implementation of this work is still in-progress see #4296
The implementation of this work is still in-progress see #4296
The implementation of this work is still in-progress see #4296
Is this feature scheduled to be implemented sometime soon? I'd be happy to get involved and help implementing it |
This feature is on hold right now, as our focus right now is getting our new storage engine integrated into all of our products. |
This issue has had no recent activity and will be closed soon. |
We want the Flux ecosystem to facilitate sharing Flux code. Currently this is not possible as Flux can only import code provided as part of the standard library. The proposal is to build the APIs necessary to host and share Flux code. Our plan is to limit the scope with which code can be shared and grow that scope as we learn more. An MVP of this proposal is to enable organizations to share Flux code within their own organization.
Technical Design
There are two parts to sharing Flux code:
Registry
The registry will need to store and serve Flux modules. An API has been previously designed and a PDF dump of its swagger doc can bee seen here. This API will very likely change but that gives an idea of what we are thinking.
The rough API will look like this:
Versioning
Flux modules will be immutable, i.e. cannot be deleted. To make a change to a module create a new version of that module. Version number will follow semantic versioning where a breaking change must increment the major version number.
Flux Engine
The Flux engine will need to support loading Flux code. This will be the process of downloading the module from the registry and including it during the execution of the Flux script.
We need to design a few aspects of this problem.
Contents of the module itself
A module must contain the code to run and other metadata in order integrate it into the runtime. This will likely exists as a zip archive of the semantic graph of the packages included in a module. Note a module may contain multiple packages.
Specification of dependencies
How does a Flux package define which versions of a module it wants to import? Some design considerations:
Flux is lightweight and a scripting language, we do not want to make it onerous on the author of a Flux script to define versions of a dependency. This means we will want clear sane defaults when a version is not specified.
Resolving versions of dependencies
Resolving a tree of dependencies will need to solve some important questions:
It is proposed that if we need to resolve to a single version of a dependency then we use Go's Minimum Version method for its simplicity. In short packages define the minimum version of a package they need and then the maximum version of all the minimums is used. Semantic versioning must be followed closely for this strategy to work. We could possibly enforce/lint semantic versioning when a module is created by directly comparing the API of the module to the previous version and generating the new version number automatically.
The text was updated successfully, but these errors were encountered: