mirror of
https://github.com/containous/traefik.git
synced 2025-01-27 14:03:51 +03:00
k8s: Do not log service fields when GetService is failing.
Update tests too.
This commit is contained in:
parent
2cd4c82092
commit
f2297dd3ed
@ -199,12 +199,12 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur
|
||||
|
||||
service, exists, err := k8sClient.GetService(i.ObjectMeta.Namespace, pa.Backend.ServiceName)
|
||||
if err != nil {
|
||||
log.Errorf("Error while retrieving service information from k8s API %s/%s: %v", service.ObjectMeta.Namespace, pa.Backend.ServiceName, err)
|
||||
log.Errorf("Error while retrieving service information from k8s API %s/%s: %v", i.ObjectMeta.Namespace, pa.Backend.ServiceName, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !exists {
|
||||
log.Errorf("Service not found for %s/%s", service.ObjectMeta.Namespace, pa.Backend.ServiceName)
|
||||
log.Errorf("Service not found for %s/%s", i.ObjectMeta.Namespace, pa.Backend.ServiceName)
|
||||
delete(templateObjects.Frontends, r.Host+pa.Path)
|
||||
continue
|
||||
}
|
||||
|
@ -2111,7 +2111,7 @@ func (c clientMock) GetIngresses(namespaces k8s.Namespaces) []*v1beta1.Ingress {
|
||||
|
||||
func (c clientMock) GetService(namespace, name string) (*v1.Service, bool, error) {
|
||||
if c.apiServiceError != nil {
|
||||
return &v1.Service{}, false, c.apiServiceError
|
||||
return nil, false, c.apiServiceError
|
||||
}
|
||||
|
||||
for _, service := range c.services {
|
||||
@ -2119,12 +2119,12 @@ func (c clientMock) GetService(namespace, name string) (*v1.Service, bool, error
|
||||
return service, true, nil
|
||||
}
|
||||
}
|
||||
return &v1.Service{}, false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
func (c clientMock) GetEndpoints(namespace, name string) (*v1.Endpoints, bool, error) {
|
||||
if c.apiEndpointsError != nil {
|
||||
return &v1.Endpoints{}, false, c.apiEndpointsError
|
||||
return nil, false, c.apiEndpointsError
|
||||
}
|
||||
|
||||
for _, endpoints := range c.endpoints {
|
||||
@ -2134,7 +2134,7 @@ func (c clientMock) GetEndpoints(namespace, name string) (*v1.Endpoints, bool, e
|
||||
}
|
||||
|
||||
if c.properExists {
|
||||
return &v1.Endpoints{}, false, nil
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
return &v1.Endpoints{}, true, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user