-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add migration for data sources. #5008
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotta run make gen
fc09e7b
to
1ba69a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
1ba69a7
to
5b16d1b
Compare
@JAORMX I forgot to add timestamps, it should be good to go now. |
5b16d1b
to
32e2828
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits about case insensitivity in names, as we don't want people to be able to do tricky things with datafetch
and dataFetch
doing different things.
-- * functions can only reference one data source, and must be deleted | ||
-- if the data source is deleted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I missed this in the design -- how do functions and data sources interact?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that a data source is a "container" of functions that also defines a namespace.
As an example, this might be a shortened version of Trusty API v2 data source
version: v1
type: data-source
name: trusty
context:
project: foo
rest:
summary:
endpoint: "https://api.trustypkg.dev/v2/summary?package_name={package_name}
method: GET
args:
- package_name:
schema:
type: string
pkg:
endpoint: "https://api.trustypkg.dev/v2/pkg?package_name={package_name}"
method: GET
args:
package_name:
schema:
type: string
This YAML defines data source trusty
having "functions" summary
and pkg
. Eventually, they would be available to Rego engine as minder.datasource.trusty.summary(...)
and minder.datasource.trusty.pkg(...)
. Some field names might be different, and some lists could be maps and vice versa, but that's about it.
Getting back to the comment, we thought that saving all that informatino in a single row of table data_sources
was too coarse, and decided to add a separate table containing functions. I'm not sure I answered your question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the last time I'd reviewed the doc, multiple endpoints for the same data source weren't in it.
The tables make sense to me.
This migration adds support for three additional tables, `data_sources` and `data_sources_functions` containing the definition of a single data source in a many-to-one relationship, and a `rule_type_data_sources` table representing the many-to-many relationship between rule types and data sources.
32e2828
to
f8bdbdd
Compare
Summary
This migration adds support for three additional tables,
data_sources
anddata_sources_functions
containing the definition of a single data source in a many-to-one relationship, and arule_type_data_sources
table representing the many-to-many relationship between rule types and data sources.Change Type
Mark the type of change your PR introduces:
Testing
Manually tested that
migrate up
andmigrate down
work as expected.Review Checklist: