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

Make credentialprovider less verbose about benign errors. #2674

Merged
merged 1 commit into from Dec 3, 2014
Merged

Make credentialprovider less verbose about benign errors. #2674

merged 1 commit into from Dec 3, 2014

Conversation

mattmoor
Copy link
Contributor

@mattmoor mattmoor commented Dec 1, 2014

In particular, a few of the utilities used within the credentialprovider had the pattern:

    glog.Errorf("while blah %s: %v", s, err)
    return nil, err

This change composes the error message that is propagated and puts the burden of logging on the caller, which gives us the new pattern:

    return nil, fmt.Errorf("while blah %s: %v", s, err)

In particular, this allows us to squelch all output during kubelet startup when we are detecting whether certain credentialprovider plugins should even be enabled.

Fixes: #2673

@kubernetes-bot
Copy link

Can one of the admins verify this patch?

@mattmoor
Copy link
Contributor Author

mattmoor commented Dec 1, 2014

@jbeda FYI

glog.V(2).Infof("body of failing http response: %v", resp.Body)
return nil, err
return nil, fmt.Errorf("http status code: %d while fetching url %s", resp.StatusCode, url)
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't wrap this error. You are transforming an instrospectable error (e.g. with an accessible status code) into an opaque string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't wrapping an error, do you mean the one above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am fixing the two above, LMK if you want me to create something more structured to hold the fmt.Errorf from this line

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you at least TODO it, I've found this to be super painful upstream when I'm trying to figure out what went wrong...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a TODO and will follow up with a PR to use a structured error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implementing the error was quick enough, so I just did it.

LMK if you have any other feedback.

@brendandburns
Copy link
Contributor

Small stuff.

--brendan

@mattmoor
Copy link
Contributor Author

mattmoor commented Dec 1, 2014

@brendandburns PTAL, I have pushed changes that avoid wrapping the errors.

In particular, a few of the utilities used within the credentialprovider had the pattern:
   glog.Errorf("while blah %s: %v", s, err)
   return nil, err

This change propagates those error message and puts the burden of logging on the caller.

In particular, this allows us to squelch all output during kubelet startup when we are detecting whether certain credentialprovider plugins should even be enabled.

Fixes: #2673
@lavalamp
Copy link
Member

lavalamp commented Dec 3, 2014

LGTM, thanks

lavalamp added a commit that referenced this pull request Dec 3, 2014
Make credentialprovider less verbose about benign errors.
@lavalamp lavalamp merged commit ffcbe2f into kubernetes:master Dec 3, 2014
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.

Error spam from credential provider when not on GCE
4 participants