Skip to content

Commit

Permalink
Minor fix to backend config errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHohn committed Jun 20, 2018
1 parent 71c4475 commit b7ed7a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/annotations/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func (svc Service) NEGEnabled() bool {

var (
ErrBackendConfigNoneFound = errors.New("no BackendConfig's found in annotation")
ErrBackendConfigInvalidJSON = errors.New("annotation is invalid json")
ErrBackendConfigAnnotationMissing = errors.New("annotation is missing")
ErrBackendConfigInvalidJSON = errors.New("BackendConfig annotation is invalid json")
ErrBackendConfigAnnotationMissing = errors.New("BackendConfig annotation is missing")
)

type BackendConfigs struct {
Expand Down
6 changes: 5 additions & 1 deletion pkg/backendconfig/backendconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ func GetServicesForBackendConfig(svcLister cache.Store, backendConfig *backendco
}
backendConfigNames, err := annotations.FromService(svc).GetBackendConfigs()
if err != nil {
glog.Errorf("Failed to get BackendConfig names from service %s/%s: %v", svc.Namespace, svc.Name, err)
// If the user did not provide the annotation at all, then we
// do not want to log an error.
if err != annotations.ErrBackendConfigAnnotationMissing {
glog.Errorf("Failed to get BackendConfig names from service %s/%s: %v", svc.Namespace, svc.Name, err)
}
continue
}
if backendConfigNames != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type ErrSvcBackendConfig struct {

// Error returns the port name/number, service name, and the underlying error.
func (e ErrSvcBackendConfig) Error() string {
return fmt.Sprintf("error getting BackendConfig for port %q on service %q, err: %v", e.ServicePortID.Port, e.ServicePortID.Service, e.Err)
return fmt.Sprintf("error getting BackendConfig for port %q on service %q, err: %v", e.ServicePortID.Port.String(), e.ServicePortID.Service.String(), e.Err)
}

// ErrBackendConfigValidation is returned when there was an error validating a BackendConfig.
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/translator/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (t *Translator) TranslateIngress(ing *extensions.Ingress, systemDefaultBack
return urlMap, errs
}

errs = append(errs, fmt.Errorf("failed to retrieve the system default backend service %q with port %q", systemDefaultBackend.Service, systemDefaultBackend.Port))
errs = append(errs, fmt.Errorf("failed to retrieve the system default backend service %q with port %q: %v", systemDefaultBackend.Service.String(), systemDefaultBackend.Port.String(), err))
return urlMap, errs
}

Expand Down

0 comments on commit b7ed7a2

Please sign in to comment.