-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
A function shared between bundles should not generate an error, or documentation should explain that it will occur #3841
Comments
Thanks @dsoguet! See the discussions from yesterday for some more background open-policy-agent/community#20 |
Thank you @anderseknert, very interesting ! The idea about having two types of import, i.e. import at compile time (strict) vs import at runtime, sounds good for me :) May be a question about all those discussions is "It is classical with computer languages to have libraries/helper code. They enable to be more efficient for several reasons (reuse, robustness, tests,...). What is the solution proned by OPA to create such libraries/helper code ?" |
Helper libraries are definitely encouraged, though they wouldn't necessarily be kept in separate bundles. The solution to this is to simply include all dependencies in a single bundle. This bundle could be composed from many other bundles, but the idea is to not rely on "runtime" dependencies to be eventually available. IMHO, the way multi-bundles break in unexpected ways (as you have shown) makes me think they shouldn't be an option in the first place. |
Also, see #3371 as I have a feeling this would solve the root cause of the issue at hand here. |
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. |
Expected Behavior
Should be possible to share data, rules and functions between bundles, or at least explain that in case of function it could generate an error, or add a feature allowing to define in which order the bundles must be loaded
Actual Behavior
Currently:
Into the documentation https://www.openpolicyagent.org/docs/v0.32.1/management-bundles/#bundle-file-format it is written
Maybe the documentation should clarify the behavior for functions sharing
Ideally I would prefer code enhancement to have the same behavior for functions than for variables and rules. It would enable to create "lib" bundles of functions. Or at worst the possibility to define in which order the bundles must be loaded.
Steps to Reproduce the Problem
opa_bundle_lib.tar.gz contains:
opa_main_project.tar.gz uses opa_bundle_lib.tar.gz:
config.txt (yaml not a file format supported by github...) is a configuration file to run a OPA server using the two bundles above
Steps to reproduce:
Sometimes:
Note that it will be necessary to wait between polling.min_delay_seconds and polling.max_delay_seconds before OPA tries to reload opa_main_project.tar.gz and finally obtain a working OPA server.
Additional Info
If you modify opa_main_project.tar.gz bundle to remove the line
you will see that no error will be raised. The problem is only on functions
The text was updated successfully, but these errors were encountered: