diff --git a/docs/tutorials/kops-dns-controller.md b/docs/tutorials/kops-dns-controller.md index 04da968bfe..4f9f285a95 100644 --- a/docs/tutorials/kops-dns-controller.md +++ b/docs/tutorials/kops-dns-controller.md @@ -21,11 +21,9 @@ The DNS record mappings try to "do the right thing", but what this means is diff ### Pods -For the external annotation, ExternalDNS will map a HostNetwork=true Pod to the external IPs of the Node. +For the external annotation, ExternalDNS will map a Pod to the external IPs of the Node. -For the internal annotation, ExternalDNS will map a HostNetwork=true Pod to the internal IPs of the Node. - -ExternalDNS ignore Pods that are not HostNetwork=true +For the internal annotation, ExternalDNS will map a Pod to the internal IPs of the Node. Annotations added to Pods will always result in an A record being created. diff --git a/source/pod.go b/source/pod.go index 36e6ffe50e..50c41b6087 100644 --- a/source/pod.go +++ b/source/pod.go @@ -21,7 +21,6 @@ import ( "sigs.k8s.io/external-dns/endpoint" - log "github.com/sirupsen/logrus" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" kubeinformers "k8s.io/client-go/informers" @@ -84,11 +83,6 @@ func (ps *podSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, error domains := make(map[string][]string) for _, pod := range pods { - if !pod.Spec.HostNetwork { - log.Debugf("skipping pod %s. hostNetwork=false", pod.Name) - continue - } - if domain, ok := pod.Annotations[internalHostnameAnnotationKey]; ok { if _, ok := domains[domain]; !ok { domains[domain] = []string{} diff --git a/source/pod_test.go b/source/pod_test.go index c138aaf5fd..b822fa71cc 100644 --- a/source/pod_test.go +++ b/source/pod_test.go @@ -249,12 +249,14 @@ func TestPodSource(t *testing.T) { }, }, { - "pods with hostNetwore=false should be ignored", + "pods with hostNetwore=false should not be ignored", "", "", []*endpoint.Endpoint{ {DNSName: "a.foo.example.org", Targets: endpoint.Targets{"54.10.11.1"}, RecordType: endpoint.RecordTypeA}, {DNSName: "internal.a.foo.example.org", Targets: endpoint.Targets{"10.0.1.1"}, RecordType: endpoint.RecordTypeA}, + {DNSName: "b.foo.example.org", Targets: endpoint.Targets{"54.10.11.2"}, RecordType: endpoint.RecordTypeA}, + {DNSName: "internal.b.foo.example.org", Targets: endpoint.Targets{"10.0.1.2"}, RecordType: endpoint.RecordTypeA}, }, false, []*corev1.Node{ @@ -304,8 +306,8 @@ func TestPodSource(t *testing.T) { Name: "my-pod2", Namespace: "kube-system", Annotations: map[string]string{ - internalHostnameAnnotationKey: "internal.a.foo.example.org", - hostnameAnnotationKey: "a.foo.example.org", + internalHostnameAnnotationKey: "internal.b.foo.example.org", + hostnameAnnotationKey: "b.foo.example.org", }, }, Spec: corev1.PodSpec{ @@ -313,7 +315,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ - PodIP: "100.0.1.2", + PodIP: "10.0.1.2", }, }, },