-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(domains): file domain #688
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.
I appreciate the direction this is driving and the conciseness of the current implementation.
Your identified constraints for what we do/do-not allow are certainly worth working through. I believe we're at a phase where constraints are valid if documented such that we can point to them - but would love to continue to weigh approaches.
When it comes to testing - I do want to call out that this should work with any provider - the conftest/opa overlay is obviously very opa heavy (as is much of our implementation with Lula - as OPA/rego is quite powerful) but we do want to ensure we're also testing against the Kyverno baseline. Something we need to practice more often.
@brandtkeller yep! I am VERY CONCERNED about how this works with kyverno - honestly I am a bit surprised by how separate the domains and providers are, because I can see a world where certain providers can only support certain domains, or where the domain resources need to be gathered by the provider so we're certain we're getting a provider-compliant output. That concerns me! |
7f39811
to
db38027
Compare
Does kyverno polices support any data schema or just Kubernetes resources? I should probably know the answer but a quick parsing of their docs seems to indicate it's highly coupled to that format... if so I don't know how we'd use it here |
provider:
type: kyverno
kyverno-spec:
policy:
apiVersion: json.kyverno.io/v1alpha1
kind: ValidatingPolicy
metadata:
name: grafana-config
spec:
rules:
- name: protocol-is-https
assert:
all:
- check:
goodconfig.ini:
server:
protocol: https |
30449bb
to
dcdb639
Compare
95dd8d7
to
c82e399
Compare
f68c8b3
to
9448d77
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.
Appreciative of the code comments and not withstanding the mention of E2E tests am quite excited about this capability.
* XML | ||
* YAML | ||
|
||
## Validations |
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.
We don't yet have a good pattern for the mapping of domain -> provider.
That said - I do like the Kyverno example below. Could we add an OPA provider example as well?
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 don't think the writing is very good but I added an OPA example! please nitpick freely.
I'm still working on this, but I'm going to split it up into a couple of smaller PRs (probably, either way I'm cleaning this mess up)(messing with directories is always a fun time) |
Description
This adds a
files
domain which use's OPA'sconftest
parser to read in a long list of configuration file types * so that rego validations can be written against the contents.I'm not thrilled with the UX right now and I'm not sure what I want to do about it, so here's a draft PR so we can discuss! The file domain takes an array of files, but the implications are that the output
DomainResources
map uses the file name as a key, so you need to include the filename in the validation:I can make a nice list of arguments why this is good, and why this is bad: on the one hand, we don't risk collision if multiple files have the same field. On the other hand, maybe it's ok if the
files
domain can only read a single file at a time and then we can leave the filename out of the map, or if we choose to merge all the data into a single "file" first. Both feel like big footguns to me. In the former case - it's entirely valid to have for e.g. a dozen terraform files where one will do. you still want to validate it all at once. in the latter - who's responsibility is it to ensure we aren't losing data due to collisions?.Also this still needs work, tests, and documentation.
From https://www.conftest.dev/:
Related Issue
Relates to # #337
Type of change
Checklist before merging