-
Notifications
You must be signed in to change notification settings - Fork 758
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
Surface template errors #129
Conversation
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>
… 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>
e5de30d
to
63d4edc
Compare
…late-errors Signed-off-by: Craig Tabita <ctab@google.com>
63d4edc
to
9566c59
Compare
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>
d75ae82
to
43d57e2
Compare
Signed-off-by: Craig Tabita <ctab@google.com>
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.
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.
pkg/controller/constrainttemplate/constrainttemplate_controller.go
Outdated
Show resolved
Hide resolved
@@ -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: ""} |
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.
This could be a known 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.
I've replaced this with "create_error". Just wanted something for any errors that could come back without a code field.
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
Signed-off-by: Craig Tabita <ctab@google.com>
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
Any errors in reconciling constraint templates caused by e.g. Rego syntax will appear in the status as a list of error objects.