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

Commit

Permalink
fail on canonical zone id not detected (#94)
Browse files Browse the repository at this point in the history
* fail on canonical zone id not detected

* propagate error for logging

* improve logging messages

* use error instead of debug

* add space after colon
  • Loading branch information
Yerken authored Mar 15, 2017
1 parent f190ec8 commit 8f1b3e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions consumers/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -84,7 +85,7 @@ func (a *awsConsumer) Sync(endpoints []*pkg.Endpoint) error {
if err != nil {
//should pass the err down the error channel
//for now just log
log.Errorf("Error changing records per zone: %s", zoneName)
log.Errorf("Error changing records per zone: %s. Error: %v", zoneName, err)
}
}(zoneName, zoneID)
}
Expand All @@ -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)
return err
}

Expand Down Expand Up @@ -205,6 +207,7 @@ func (a *awsConsumer) Process(endpoint *pkg.Endpoint) error {

ARecords, err := a.endpointsToRecords([]*pkg.Endpoint{endpoint})
if err != nil {
log.Errorf("failed to convert endpoint to RRS: %v. Aborting process...", err)
return err
}
if len(ARecords) != 1 {
Expand Down Expand Up @@ -331,7 +334,7 @@ func (a *awsConsumer) endpointsToRecords(endpoints []*pkg.Endpoint) ([]*route53.
} else if ep.IP != "" {
rset = append(rset, a.endpointToRecord(ep, aws.String("")))
} else {
log.Errorf("Canonical Zone ID for endpoint: %s was not found", ep.Hostname)
return nil, fmt.Errorf("Canonical Zone ID for load balancer: %s was not found", ep.Hostname)
}
}
return rset, nil
Expand Down
2 changes: 1 addition & 1 deletion producers/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
ing.Namespace, ing.Name,
)
case len(ing.Status.LoadBalancer.Ingress) > 1:
Expand Down
2 changes: 1 addition & 1 deletion producers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
svc.Namespace, svc.Name,
)
case len(svc.Status.LoadBalancer.Ingress) > 1:
Expand Down

0 comments on commit 8f1b3e3

Please sign in to comment.