-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
✨ Improve ErrorMessage from referenced resources #1325
✨ Improve ErrorMessage from referenced resources #1325
Conversation
Signed-off-by: Vince Prignano <vincepri@vmware.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-cluster-api-test |
cluster.Status.ErrorMessage = pointer.StringPtr(errorMessage) | ||
cluster.Status.ErrorMessage = pointer.StringPtr( | ||
fmt.Sprintf("Failure detected from referenced resource %v with name %q: %s", | ||
obj.GroupVersionKind(), obj.GetName(), errorMessage), |
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.
Does %v on schema.GroupVersionKind automatically convert to string? Would it be better to use %q and obj.GroupVersionKind().String() ?
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.
They should both call String()
, the only difference is that %q quotes it, not sure if that's necessary in this case, but we can always revisit later if it doesn't look good 😄.
We do this in a bunch of places already throughout the logs
@@ -128,7 +129,10 @@ func (r *MachineReconciler) reconcileExternal(ctx context.Context, m *v1alpha2.M | |||
m.Status.ErrorReason = &machineStatusError | |||
} | |||
if errorMessage != "" { | |||
m.Status.ErrorMessage = pointer.StringPtr(errorMessage) | |||
m.Status.ErrorMessage = pointer.StringPtr( |
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 should probably aggregate these for all referenced resources.
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.
Only the first one will ever be set I think, the Machine goes into a failure state after these fields are set
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.
When we start attempting to validate credentials in the AWS provider, I could easily see a situation where both invalid credentials are used and invalid bootstrapping config provided, since we wouldn't necessarily need the bootstrapping data to validate credentials, it would be better to provide the user with both errors rather than a single one.
I removed the |
/lgtm |
Signed-off-by: Vince Prignano vincepri@vmware.com
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Related to #1294