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

fail on canonical zone id not detected #94

Merged
merged 5 commits into from
Mar 15, 2017

Conversation

ideahitme
Copy link
Contributor

No description provided.

@ideahitme
Copy link
Contributor Author

👍

@ideahitme
Copy link
Contributor Author

👍

consumers/aws.go Outdated
@@ -95,6 +96,7 @@ func (a *awsConsumer) Sync(endpoints []*pkg.Endpoint) error {
func (a *awsConsumer) syncPerHostedZone(kubeRecords []*route53.ResourceRecordSet, zoneID string) error {
existingRecords, err := a.client.ListRecordSets(zoneID)
if err != nil {
log.Errorf("failed to list records in zoneID:%s. Error: %v", zoneID, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: space after colon

@@ -140,7 +140,7 @@ func validateIngress(ing extensions.Ingress, filter map[string]string) error {
switch {
case len(ing.Status.LoadBalancer.Ingress) == 0:
return fmt.Errorf(
"[Ingress] The load balancer of ingress '%s/%s' does not have any ingress.",
"[Ingress] The load balancer field of ingress '%s/%s' is empty",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -147,7 +147,7 @@ func validateService(svc api.Service, filter map[string]string) error {
switch {
case len(svc.Status.LoadBalancer.Ingress) == 0:
return fmt.Errorf(
"[Service] The load balancer of service '%s/%s' does not have any ingress.",
"[Service] The load balancer field of service '%s/%s' is empty",
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 this message was very confusing

@hjacobs
Copy link
Contributor

hjacobs commented Mar 15, 2017

LGTM

@linki
Copy link
Owner

linki commented Mar 15, 2017

👍

@ideahitme
Copy link
Contributor Author

👍

@ideahitme ideahitme merged commit 8f1b3e3 into master Mar 15, 2017
@ideahitme ideahitme deleted the hotfix/handle-endpoints-conversion-fail branch March 15, 2017 09:02
@@ -53,6 +53,7 @@ func withClient(c AWSClient, groupID string) *awsConsumer {
func (a *awsConsumer) Sync(endpoints []*pkg.Endpoint) error {
kubeRecords, err := a.endpointsToRecords(endpoints)
if err != nil {
log.Errorf("failed to convert endpoints to RRS: %v. Aborting sync...", err)
return err
Copy link
Collaborator

Choose a reason for hiding this comment

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

In general errors should either be logged or returned, but not both.

To quote Dave Cheney:

If you choose to handle the error by logging it, by definition it’s not an error any more — you handled it. The act of logging an error handles the error, hence it is no longer appropriate to log it as an 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.

yes, totally make sense. Initially I wanted to print debug message, but I thought debug is not relevant here either. If error is not logged here with additional message, then it is a bit difficult to figure where the flow is aborted

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would wrap the returned error in fmt.Errorf with the same text from the log, and then have the caller log it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, there are few other places where it needs to be changed, but probably will do it in next PR

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.

4 participants