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

✨ Improve ErrorMessage from referenced resources #1325

Conversation

vincepri
Copy link
Member

@vincepri vincepri commented Aug 27, 2019

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

Signed-off-by: Vince Prignano <vincepri@vmware.com>
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 27, 2019
@vincepri
Copy link
Member Author

/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),
Copy link
Member

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() ?

Copy link
Member Author

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(
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

@ncdc
Copy link
Contributor

ncdc commented Sep 4, 2019

@detiber @vincepri given that we moved #1294 to Next, how do you want to handle this PR?

@vincepri
Copy link
Member Author

vincepri commented Sep 4, 2019

I removed the Fixes ... so it won't close the linked issue. The PR gives us a nicer error message, which could help UX?

@detiber
Copy link
Member

detiber commented Sep 4, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 4, 2019
@k8s-ci-robot k8s-ci-robot merged commit b9b33c7 into kubernetes-sigs:master Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants