From 03c3c8fcb895166d6535d52bd0c2cfe52342dd14 Mon Sep 17 00:00:00 2001 From: "dan.simone@oracle.com" Date: Wed, 14 Apr 2021 13:21:03 -0700 Subject: [PATCH] Address remove comments --- source/ingress.go | 4 ++-- source/ingress_test.go | 4 ++-- source/source.go | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/ingress.go b/source/ingress.go index 85ab4d8b3..23bea7c29 100644 --- a/source/ingress.go +++ b/source/ingress.go @@ -297,10 +297,10 @@ func endpointsFromIngress(ing *v1beta1.Ingress, ignoreHostnameAnnotation bool, i // Include endpoints according to the hostname source annotation in our final list var endpoints []*endpoint.Endpoint - if strings.ToLower(hostnameSourceAnnotation) != IngressHostnameSourceAnnotationOnlyValue { + if strings.ToLower(hostnameSourceAnnotation) == IngressHostnameSourceDefinedHostsOnlyValue { endpoints = append(endpoints, definedHostsEndpoints...) } - if strings.ToLower(hostnameSourceAnnotation) != IngressHostnameSourceDefinedHostsOnlyValue { + if strings.ToLower(hostnameSourceAnnotation) == IngressHostnameSourceAnnotationOnlyValue { endpoints = append(endpoints, annotationEndpoints...) } return endpoints diff --git a/source/ingress_test.go b/source/ingress_test.go index 1f30e3037..0840e241b 100644 --- a/source/ingress_test.go +++ b/source/ingress_test.go @@ -268,10 +268,10 @@ func testEndpointsFromIngressHostnameSourceAnnotation(t *testing.T) { }, }, { - title: "Ingress-hostname-source=all, one rule.host, one annotation host", + title: "No ingress-hostname-source annotation, one rule.host, one annotation host", ingress: fakeIngress{ dnsnames: []string{"foo.bar"}, - annotations: map[string]string{hostnameAnnotationKey: "foo.baz", ingressHostnameSourceKey: "all"}, + annotations: map[string]string{hostnameAnnotationKey: "foo.baz"}, hostnames: []string{"lb.com"}, }, expected: []*endpoint.Endpoint{ diff --git a/source/source.go b/source/source.go index 0bf95383b..302002623 100644 --- a/source/source.go +++ b/source/source.go @@ -49,7 +49,6 @@ const ( // The annotation used to determine the source of hostnames for ingresses ingressHostnameSourceKey = "external-dns.alpha.kubernetes.io/ingress-hostname-source" // The value of the controller annotation so that we feel responsible - // The value of the controller annotation so that we feel responsible controllerAnnotationValue = "dns-controller" // The annotation used for defining the desired hostname internalHostnameAnnotationKey = "external-dns.alpha.kubernetes.io/internal-hostname"