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

Expose last warnings from eventlog for Pod+PVC+SVC #16

Merged
merged 1 commit into from
Jul 5, 2017

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Jul 3, 2017

Examples

Service

* kubernetes_service.test: Waiting for service "default/radek-blablah" to assign IP/hostname for a load balancer
   * CreatingLoadBalancerFailed: Error creating load balancer (will retry): Failed to create load balancer for service default/radek-blablah: requested ip 10.0.0.1 is neither static nor assigned to LB a049988bc615511e781c642010a8a005(default/radek-blablah): <nil>

PVC

* kubernetes_persistent_volume_claim.example: timeout while waiting for state to become 'Bound' (last state: 'Pending', timeout: 5m0s)
   * ProvisioningFailed: Failed to provision volume with StorageClass "standard": claim.Spec.Selector is not supported for dynamic provisioning on GCE

Pod

* kubernetes_pod.test: timeout while waiting for state to become 'Running' (last state: 'Pending', timeout: 5m0s)
   * FailedSync: Error syncing pod, skipping: failed to "StartContainer" for "example" with ImagePullBackOff: "Back-off pulling image \"nginx:notexists\""

   * Failed: Failed to pull image "nginx:notexists": rpc error: code = 2 desc = Tag notexists not found in repository docker.io/library/nginx
   * FailedSync: Error syncing pod, skipping: failed to "StartContainer" for "example" with ErrImagePull: "rpc error: code = 2 desc = Tag notexists not found in repository docker.io/library/nginx"

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

otherwise LGTM :)

}
return fmt.Errorf("%s%s", err, reason)
return fmt.Errorf("%s%s", err, warns)
Copy link
Contributor

Choose a reason for hiding this comment

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

given it's being used in multiple resources, any reason to not pull this out into a separate method?

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed, we can do this later if the error handling sprawls through more resources. I think there's still benefit in not decoupling it as we're making an API call here and it should be more obvious from these extra LOC that something "heavy-weighted" is happening here. 🙂

return wErr
}
if len(lastWarnings) > 0 {
warns = fmt.Sprintf(". Last warnings: %s", stringifyEvents(lastWarnings))
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd argue this would read cleaner if only returning the combined err + warns object within this if statement?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I'll change that. 👍

@radeksimko radeksimko force-pushed the f-expose-failure-reasons branch from 5e0aa8b to 4aaf4a0 Compare July 5, 2017 07:37
@radeksimko radeksimko merged commit a0f1d4e into master Jul 5, 2017
@radeksimko radeksimko deleted the f-expose-failure-reasons branch July 5, 2017 07:47
ddub pushed a commit to ddub/terraform-provider-kubernetes that referenced this pull request Jun 21, 2018
@ghost ghost locked and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants