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

Minor fix to backend config errors #351

Merged
merged 1 commit into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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