You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, AddConstraint's definition (docs) states:
// AddConstraint adds a Constraint to Driver for a particular Template. Future
// calls to Query may reference the added Constraint. Replaces the existing
// Constraint if it already exists.
AddConstraint(ctx context.Context, constraint *unstructured.Unstructured) error
However, if no Template has already been added, via AddTemplate, the behavior is undefined. At present, the rego driver "fails silently":
Define the behavior and enforce it. Update the docs and if the targets is not found err out with some helpful error like TemplateNotFound
targets, found := ...
if not found, error
Modify the signature of AddConstraint to also include the Template that we want to associate the Constraint with. This approach would probably require some rethinking or regrokking of the flow for both AddTemplate and AddConstraint so it may actually be more work than value.
The text was updated successfully, but these errors were encountered:
overview
At the moment,
AddConstraint
's definition (docs) states:However, if no
Template
has already been added, viaAddTemplate
, the behavior is undefined. At present, therego
driver "fails silently":frameworks/constraint/pkg/client/drivers/rego/driver.go
Lines 150 to 164 in 3f237e2
solutions
TemplateNotFound
AddConstraint
to also include the Template that we want to associate the Constraint with. This approach would probably require some rethinking or regrokking of the flow for both AddTemplate and AddConstraint so it may actually be more work than value.The text was updated successfully, but these errors were encountered: