Bundles
Bundles in Styra Load are similar to OPA bundles and are the main mechanism for providing policies and data to a Load instance.
To make Styra Load more performant for large data sets, the bundle format used in Styra Load is different from that which is used in OPA. The Styra Load format is based on a binary JSON representation of data which allows Load to process queries using less memory. Load has built in functionality to convert OPA Bundles to the Load Bundle format.
Converting an existing OPA Bundle
If you already have an OPA Bundle, you can convert it to the Load Bundle format using the load bundle convert
command. For example, if the OPA Bundle is named bundle.tar.gz
:
$ load bundle convert bundle.tar.gz bundle-load.tar.gz
The new archive: bundle-load.tar.gz
will contain the same bundle data but in a format suitable for Load to use.
Creating a new Styra Load Bundle
To create a new Styra Load Bundle from a local directory, first use Styra Load to create an OPA Bundle and then convert it to the Styra Load format:
$ ls bundle/
example.rego
$ cat bundle/example.rego
package example
allow := true
$ load build -b bundle/
$ tar tzf bundle.tar.gz
/data.json
/foo/example.rego
$ load bundle convert bundle.tar.gz bundle-load.tar.gz
Bundle Service API with Styra Load Bundles
Other than the difference in the bundle format outlined above, Styra Load handles bundles in the same way as OPA. Using the same configuration options as OPA, Styra Load can be configured to download Styra Load bundles using the Bundle Service API.
It is not possible to use the Load Bundle format for Discovery Bundles at this time.
See the following for additional information: