-
Notifications
You must be signed in to change notification settings - Fork 52
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
Support custom constraint (templates) #553
Conversation
e759325
to
0919e1d
Compare
1c129ee
to
d1bc817
Compare
@@ -181,18 +181,21 @@ func (r Rego) AnnotationParameters() map[string]apiextensionsv1.JSONSchemaProps | |||
return r.annoParameters | |||
} | |||
|
|||
func (r Rego) GetAnnotation(name string) (any, bool) { | |||
func (r Rego) GetAnnotation(name string) (any, error) { |
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.
Had to change the signature here due to https://go.dev/src/text/template/funcs.go?s=14790:14826
b48022a
to
bcb185d
Compare
I added a bit of doc to explain when this can be useful. :) |
89507e7
to
3b1d377
Compare
3b1d377
to
26e720a
Compare
Policy check is failing due to missing "if", should be fixed with #564 |
583b823
to
525ddc1
Compare
@jalseth this includes now a commit that fixes the failing CI due to opa v0 compatibility. |
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 for the PR! And apologies for the long delay in getting to this.
525ddc1
to
fccb865
Compare
10036ca
to
7085b61
Compare
60e164d
to
44f595f
Compare
44f595f
to
59fb085
Compare
This PR adds support for a custom template to generate constraints and constrainttemplates with. This can be helpful in case you want to generate a helm chart or a different non-structured deployment artifact using konstraint. I've added internal/commands/constrainttemplate_template.tpl and internal/commands/constraint_template.tpl as examples how this could look like.
In addition, this adds sprout as a dependency to support more functions in the custom document template.
TODO:
Fixes: #236