From 4cc24bd2164c139611c5691237505563744cad7e Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Thu, 2 Feb 2017 08:11:19 -0300 Subject: [PATCH] Fix nil HTTP field --- .../ingress/controller/annotations_test.go | 26 +++++++++---------- core/pkg/ingress/controller/controller.go | 3 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/pkg/ingress/controller/annotations_test.go b/core/pkg/ingress/controller/annotations_test.go index f577920db..58b0d8093 100644 --- a/core/pkg/ingress/controller/annotations_test.go +++ b/core/pkg/ingress/controller/annotations_test.go @@ -28,10 +28,10 @@ import ( ) const ( - annotation_secureUpstream = "ingress.kubernetes.io/secure-backends" - annotation_upsMaxFails = "ingress.kubernetes.io/upstream-max-fails" - annotation_upsFailTimeout = "ingress.kubernetes.io/upstream-fail-timeout" - annotation_passthrough = "ingress.kubernetes.io/ssl-passthrough" + annotationSecureUpstream = "ingress.kubernetes.io/secure-backends" + annotationUpsMaxFails = "ingress.kubernetes.io/upstream-max-fails" + annotationUpsFailTimeout = "ingress.kubernetes.io/upstream-fail-timeout" + annotationPassthrough = "ingress.kubernetes.io/ssl-passthrough" ) type mockCfg struct { @@ -106,9 +106,9 @@ func TestSecureUpstream(t *testing.T) { annotations map[string]string er bool }{ - {map[string]string{annotation_secureUpstream: "true"}, true}, - {map[string]string{annotation_secureUpstream: "false"}, false}, - {map[string]string{annotation_secureUpstream + "_no": "true"}, false}, + {map[string]string{annotationSecureUpstream: "true"}, true}, + {map[string]string{annotationSecureUpstream: "false"}, false}, + {map[string]string{annotationSecureUpstream + "_no": "true"}, false}, {map[string]string{}, false}, {nil, false}, } @@ -131,9 +131,9 @@ func TestHealthCheck(t *testing.T) { eumf int euft int }{ - {map[string]string{annotation_upsMaxFails: "3", annotation_upsFailTimeout: "10"}, 3, 10}, - {map[string]string{annotation_upsMaxFails: "3"}, 3, 0}, - {map[string]string{annotation_upsFailTimeout: "10"}, 0, 10}, + {map[string]string{annotationUpsMaxFails: "3", annotationUpsFailTimeout: "10"}, 3, 10}, + {map[string]string{annotationUpsMaxFails: "3"}, 3, 0}, + {map[string]string{annotationUpsFailTimeout: "10"}, 0, 10}, {map[string]string{}, 0, 0}, {nil, 0, 0}, } @@ -164,9 +164,9 @@ func TestSSLPassthrough(t *testing.T) { annotations map[string]string er bool }{ - {map[string]string{annotation_passthrough: "true"}, true}, - {map[string]string{annotation_passthrough: "false"}, false}, - {map[string]string{annotation_passthrough + "_no": "true"}, false}, + {map[string]string{annotationPassthrough: "true"}, true}, + {map[string]string{annotationPassthrough: "false"}, false}, + {map[string]string{annotationPassthrough + "_no": "true"}, false}, {map[string]string{}, false}, {nil, false}, } diff --git a/core/pkg/ingress/controller/controller.go b/core/pkg/ingress/controller/controller.go index 146a00aa3..408c729e8 100644 --- a/core/pkg/ingress/controller/controller.go +++ b/core/pkg/ingress/controller/controller.go @@ -620,9 +620,8 @@ func (ic *GenericController) getBackendServers() ([]*ingress.Backend, []*ingress } if rule.HTTP == nil && - len(ing.Spec.TLS) == 0 && host != defServerName { - glog.V(3).Infof("ingress rule %v/%v does not contains HTTP or TLS rules. using default backend", ing.Namespace, ing.Name) + glog.V(3).Infof("ingress rule %v/%v does not contains HTTP rules. using default backend", ing.Namespace, ing.Name) server.Locations[0].Backend = defBackend.Name continue }