Skip to content
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

Surface template errors #129

Merged
merged 22 commits into from
Jun 12, 2019

Conversation

ctab
Copy link
Member

@ctab ctab commented Jun 8, 2019

Any errors in reconciling constraint templates caused by e.g. Rego syntax will appear in the status as a list of error objects.

ctab added 12 commits May 16, 2019 15:26
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
@ctab ctab force-pushed the surface-template-errors branch from e5de30d to 63d4edc Compare June 8, 2019 01:19
…late-errors

Signed-off-by: Craig Tabita <ctab@google.com>
@ctab ctab force-pushed the surface-template-errors branch from 63d4edc to 9566c59 Compare June 8, 2019 01:19
ctab added 5 commits June 10, 2019 10:03
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
…into surface-template-errors

Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.

The biggest missing piece is that we need some code to remove errors once they no longer apply.

I suggest moving k8s errors for creating a CRD (line 211 in new code) to a known error so that it can be filtered and removed once the CRD is successfully created.

We also need a way of clearing parsing errors once the Rego successfully parses.

@@ -180,7 +207,9 @@ func (r *ReconcileConstraintTemplate) handleCreate(
}
log.Info("creating constraint CRD")
if err := r.Create(context.TODO(), crd); err != nil {
instance.Status.Error = fmt.Sprintf("Could not create CRD: %s", err)
instance.Status.Errors = []*v1alpha1.CreateCRDError{}
createErr := &v1alpha1.CreateCRDError{Code: "unknown_error", Message: fmt.Sprintf("Could not create CRD: %s", err), Location: ""}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a known error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replaced this with "create_error". Just wanted something for any errors that could come back without a code field.

ctab added 2 commits June 11, 2019 11:37
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maxsmythe maxsmythe merged commit 136c559 into open-policy-agent:master Jun 12, 2019
@ctab ctab deleted the surface-template-errors branch June 12, 2019 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants