Skip to content
This repository was archived by the owner on Jul 25, 2019. It is now read-only.

Return better errors from SetUpPod/TearDownPod #295

Merged
merged 1 commit into from
Apr 15, 2016

Conversation

danwinship
Copy link
Contributor

Fixes #290
@openshift/networking PTAL

Previously when errors occured in SetUpPod(), we ended up logging just
"exit status 1" (unless we were running at --loglevel=5). Fix that.

This also switches the code to use os/exec directly rather than
kubernetes's wrapper, so we can check the return error type.
(Kubernetes's exec wraps the error in a private type.)
return err

if isScriptError(err) {
return fmt.Errorf("Error running network setup script: %s", getScriptError(out))

Choose a reason for hiding this comment

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

Can you also include pod name and namespace in the error msg? I think that will be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

kubernetes adds that when it logs the error:

message := fmt.Sprintf("Failed to setup network for pod %q using network plugins %q: %v; Skipping pod", format.Pod(pod), dm.networkPlugin.Name(), err)

where format.Pod(pod) outputs fmt.Sprintf("%s_%s(%s)", pod.Name, pod.Namespace, pod.UID)

@pravisankar
Copy link

Minor comment, LGTM overall

@dcbw
Copy link
Contributor

dcbw commented Apr 15, 2016

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants