From 21b60b914e5f812ef2508f5a8aebb9294761664b Mon Sep 17 00:00:00 2001 From: Sumit Solanki Date: Fri, 17 Apr 2026 17:28:24 +0530 Subject: [PATCH 1/4] fix(source): skip pod DNS when PodIP is empty for IP-derived records Signed-off-by: Sumit Solanki --- source/pod.go | 18 +++++++++-- source/pod_test.go | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/source/pod.go b/source/pod.go index 5ebfde27c5..4449920f3b 100644 --- a/source/pod.go +++ b/source/pod.go @@ -185,6 +185,10 @@ func (ps *podSource) addPodEndpointsToEndpointMap(endpointMap map[endpoint.Endpo func (ps *podSource) addInternalHostnameAnnotationEndpoints(endpointMap map[endpoint.EndpointKey][]string, pod *v1.Pod, targets []string) { if domainAnnotation, ok := pod.Annotations[annotations.InternalHostnameKey]; ok { domainList := annotations.SplitHostnameAnnotation(domainAnnotation) + if len(targets) == 0 && pod.Status.PodIP == "" { + log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) + return + } for _, domain := range domainList { if len(targets) == 0 { addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) @@ -210,8 +214,12 @@ func (ps *podSource) addKopsDNSControllerEndpoints(endpointMap map[endpoint.Endp if ps.compatibility == "kops-dns-controller" { if domainAnnotation, ok := pod.Annotations[kopsDNSControllerInternalHostnameAnnotationKey]; ok { domainList := annotations.SplitHostnameAnnotation(domainAnnotation) - for _, domain := range domainList { - addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) + if pod.Status.PodIP == "" { + log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) + } else { + for _, domain := range domainList { + addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) + } } } @@ -226,7 +234,11 @@ func (ps *podSource) addPodSourceDomainEndpoints(endpointMap map[endpoint.Endpoi if ps.podSourceDomain != "" { domain := pod.Name + "." + ps.podSourceDomain if len(targets) == 0 { - addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) + if pod.Status.PodIP == "" { + log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) + } else { + addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) + } } addTargetsToEndpointMap(endpointMap, pod, targets, domain) } diff --git a/source/pod_test.go b/source/pod_test.go index f58bed9000..337bc8aa38 100644 --- a/source/pod_test.go +++ b/source/pod_test.go @@ -737,6 +737,83 @@ func TestPodSource(t *testing.T) { }, }, }, + { + "pending pod with empty PodIP and internal-hostname annotation should not create CNAME", + "", + "", + false, + "", + []*endpoint.Endpoint{}, + false, + nil, + []*corev1.Pod{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "pending-pod", + Namespace: "kube-system", + Annotations: map[string]string{ + annotations.InternalHostnameKey: "foo.example.com", + }, + }, + Spec: corev1.PodSpec{ + HostNetwork: false, + }, + Status: corev1.PodStatus{ + Phase: corev1.PodPending, + PodIP: "", + }, + }, + }, + }, + { + "pending pod with empty PodIP and pod-source-domain should not create CNAME", + "", + "", + false, + "example.org", + []*endpoint.Endpoint{}, + false, + nil, + []*corev1.Pod{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "pending-pod", + Namespace: "kube-system", + }, + Spec: corev1.PodSpec{HostNetwork: false}, + Status: corev1.PodStatus{ + Phase: corev1.PodPending, + PodIP: "", + }, + }, + }, + }, + { + "pending pod with empty PodIP and kops-dns-controller annotation should not create CNAME", + "", + "kops-dns-controller", + false, + "", + []*endpoint.Endpoint{}, + false, + nil, + []*corev1.Pod{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "pending-pod", + Namespace: "kube-system", + Annotations: map[string]string{ + kopsDNSControllerInternalHostnameAnnotationKey: "foo.example.com", + }, + }, + Spec: corev1.PodSpec{HostNetwork: false}, + Status: corev1.PodStatus{ + Phase: corev1.PodPending, + PodIP: "", + }, + }, + }, + }, } { t.Run(tc.title, func(t *testing.T) { kubernetes := fake.NewClientset() From 2c01843884661bd1e4eff654af679e16322f256e Mon Sep 17 00:00:00 2001 From: Sumit Solanki Date: Thu, 30 Apr 2026 15:53:02 +0530 Subject: [PATCH 2/4] fix(source): skip annotation pod DNS unless Running; clarify pod-source-domain flow --- docs/sources/pod.md | 6 ++++ source/pod.go | 34 +++++++++------------ source/pod_fqdn_test.go | 13 +++++++++ source/pod_test.go | 65 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 20 deletions(-) diff --git a/docs/sources/pod.md b/docs/sources/pod.md index 0037ad86b2..5794fb944b 100644 --- a/docs/sources/pod.md +++ b/docs/sources/pod.md @@ -2,6 +2,12 @@ The pod source creates DNS entries based on `Pod` resources. +## Pod phase + +Records derived from pod annotations (for example hostname, internal hostname, `--pod-source-domain`, and compatibility annotations) are only generated when the pod `status.phase` is `Running`. Pods that have not started or have terminated do not contribute annotation-based endpoints, including when they carry explicit target annotations. + +FQDN template expansion (`--fqdn-template`) is combined separately and still evaluates templates using the pod object as seen in the informer cache. + ## Pods not running with host networking By default, the pod source will consider the pods that aren't running with host networking enabled. You can override this behavior by using the `--ignore-non-host-network-pods` option to ignore non host networking pods. diff --git a/source/pod.go b/source/pod.go index 4449920f3b..3efe76446d 100644 --- a/source/pod.go +++ b/source/pod.go @@ -173,6 +173,10 @@ func (ps *podSource) addPodEndpointsToEndpointMap(endpointMap map[endpoint.Endpo log.Debugf("skipping pod %s. hostNetwork=false", pod.Name) return } + if pod.Status.Phase != v1.PodRunning { + log.Debugf("skipping pod %q. phase is %q", pod.Name, pod.Status.Phase) + return + } targets := annotations.TargetsFromTargetAnnotation(pod.Annotations) @@ -185,10 +189,6 @@ func (ps *podSource) addPodEndpointsToEndpointMap(endpointMap map[endpoint.Endpo func (ps *podSource) addInternalHostnameAnnotationEndpoints(endpointMap map[endpoint.EndpointKey][]string, pod *v1.Pod, targets []string) { if domainAnnotation, ok := pod.Annotations[annotations.InternalHostnameKey]; ok { domainList := annotations.SplitHostnameAnnotation(domainAnnotation) - if len(targets) == 0 && pod.Status.PodIP == "" { - log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) - return - } for _, domain := range domainList { if len(targets) == 0 { addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) @@ -214,12 +214,8 @@ func (ps *podSource) addKopsDNSControllerEndpoints(endpointMap map[endpoint.Endp if ps.compatibility == "kops-dns-controller" { if domainAnnotation, ok := pod.Annotations[kopsDNSControllerInternalHostnameAnnotationKey]; ok { domainList := annotations.SplitHostnameAnnotation(domainAnnotation) - if pod.Status.PodIP == "" { - log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) - } else { - for _, domain := range domainList { - addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) - } + for _, domain := range domainList { + addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) } } @@ -231,17 +227,15 @@ func (ps *podSource) addKopsDNSControllerEndpoints(endpointMap map[endpoint.Endp } func (ps *podSource) addPodSourceDomainEndpoints(endpointMap map[endpoint.EndpointKey][]string, pod *v1.Pod, targets []string) { - if ps.podSourceDomain != "" { - domain := pod.Name + "." + ps.podSourceDomain - if len(targets) == 0 { - if pod.Status.PodIP == "" { - log.Debugf("skipping pod %q. PodIP is empty with phase %q", pod.Name, pod.Status.Phase) - } else { - addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) - } - } - addTargetsToEndpointMap(endpointMap, pod, targets, domain) + if ps.podSourceDomain == "" { + return + } + domain := pod.Name + "." + ps.podSourceDomain + if len(targets) == 0 { + addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) + return } + addTargetsToEndpointMap(endpointMap, pod, targets, domain) } func (ps *podSource) addPodNodeEndpointsToEndpointMap(endpointMap map[endpoint.EndpointKey][]string, pod *v1.Pod, domainList []string) { diff --git a/source/pod_fqdn_test.go b/source/pod_fqdn_test.go index 85b84c33e8..0c6d38ed01 100644 --- a/source/pod_fqdn_test.go +++ b/source/pod_fqdn_test.go @@ -49,6 +49,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { Namespace: "default", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -76,6 +77,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { NodeName: "node-1.internal", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -111,6 +113,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { Namespace: "default", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -123,6 +126,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { Namespace: "kube-system", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.102", PodIPs: []v1.PodIP{ {IP: "100.67.94.102"}, @@ -145,6 +149,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { Namespace: "default", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -171,6 +176,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -195,6 +201,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -219,6 +226,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -234,6 +242,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.102", PodIPs: []v1.PodIP{ {IP: "100.67.94.102"}, @@ -259,6 +268,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -274,6 +284,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { }, }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.102", PodIPs: []v1.PodIP{ {IP: "100.67.94.102"}, @@ -296,6 +307,7 @@ func TestPodSourceFqdnTemplatingExamples(t *testing.T) { Namespace: "kube-system", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, @@ -436,6 +448,7 @@ func TestPodSourceFqdnTemplatingExamples_Failed(t *testing.T) { Namespace: "kube-system", }, Status: v1.PodStatus{ + Phase: v1.PodRunning, PodIP: "100.67.94.101", PodIPs: []v1.PodIP{ {IP: "100.67.94.101"}, diff --git a/source/pod_test.go b/source/pod_test.go index 337bc8aa38..375d480014 100644 --- a/source/pod_test.go +++ b/source/pod_test.go @@ -85,6 +85,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -102,6 +103,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.2", }, }, @@ -134,6 +136,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -151,6 +154,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.2", }, }, @@ -183,6 +187,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "2001:DB8::1", }, }, @@ -200,6 +205,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "2001:DB8::2", }, }, @@ -232,6 +238,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "2001:DB8::1", }, }, @@ -249,6 +256,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "2001:DB8::2", }, }, @@ -282,6 +290,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -300,6 +309,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.2", }, }, @@ -357,6 +367,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -373,6 +384,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.2", }, }, @@ -406,6 +418,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -423,6 +436,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "100.0.1.2", }, }, @@ -455,6 +469,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -473,6 +488,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "100.0.1.2", }, }, @@ -515,6 +531,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -546,6 +563,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "192.168.1.1", }, }, @@ -560,6 +578,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "192.168.1.2", }, }, @@ -590,6 +609,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "192.168.1.1", }, }, @@ -620,6 +640,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "192.168.1.1", }, }, @@ -655,6 +676,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -673,6 +695,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.2", }, }, @@ -701,6 +724,7 @@ func TestPodSource(t *testing.T) { NodeName: "missing-node", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -732,6 +756,7 @@ func TestPodSource(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -765,6 +790,37 @@ func TestPodSource(t *testing.T) { }, }, }, + { + "internal-hostname with explicit targets uses targets when PodIP is empty", + "", + "", + false, + "", + []*endpoint.Endpoint{ + {DNSName: "internal.targets.example.org", Targets: endpoint.Targets{"203.0.113.1"}, RecordType: endpoint.RecordTypeA}, + }, + false, + nil, + []*corev1.Pod{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "pod-with-targets", + Namespace: "kube-system", + Annotations: map[string]string{ + annotations.InternalHostnameKey: "internal.targets.example.org", + annotations.TargetKey: "203.0.113.1", + }, + }, + Spec: corev1.PodSpec{ + HostNetwork: false, + }, + Status: corev1.PodStatus{ + Phase: corev1.PodRunning, + PodIP: "", + }, + }, + }, + }, { "pending pod with empty PodIP and pod-source-domain should not create CNAME", "", @@ -894,6 +950,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "100.0.1.1", }, }, @@ -919,6 +976,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "missing-node", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -946,6 +1004,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -962,6 +1021,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "my-node2", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "100.0.1.2", }, }, @@ -978,6 +1038,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "missing-node", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.3", }, }, @@ -1009,6 +1070,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -1038,6 +1100,7 @@ func TestPodSourceLogs(t *testing.T) { NodeName: "my-node1", }, Status: corev1.PodStatus{ + Phase: corev1.PodRunning, PodIP: "10.0.1.1", }, }, @@ -1335,6 +1398,7 @@ func TestProcessEndpoint_Pod_RefObjectExist(t *testing.T) { }, UID: "uid-1", }, + Status: v1.PodStatus{Phase: v1.PodRunning}, }, &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ @@ -1346,6 +1410,7 @@ func TestProcessEndpoint_Pod_RefObjectExist(t *testing.T) { }, UID: "uid-2", }, + Status: v1.PodStatus{Phase: v1.PodRunning}, }, } From c738bd62a01f725a9644c4f4ab6e08255dab915f Mon Sep 17 00:00:00 2001 From: Sumit Solanki Date: Thu, 30 Apr 2026 15:56:59 +0530 Subject: [PATCH 3/4] The failure comes from markdownlint rule MD013, which caps lines at 300 characters. Line 7 in docs/sources/pod.md was one long paragraph (340 characters). Signed-off-by: Sumit Solanki --- docs/sources/pod.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/sources/pod.md b/docs/sources/pod.md index 5794fb944b..0324ffdb2c 100644 --- a/docs/sources/pod.md +++ b/docs/sources/pod.md @@ -4,7 +4,8 @@ The pod source creates DNS entries based on `Pod` resources. ## Pod phase -Records derived from pod annotations (for example hostname, internal hostname, `--pod-source-domain`, and compatibility annotations) are only generated when the pod `status.phase` is `Running`. Pods that have not started or have terminated do not contribute annotation-based endpoints, including when they carry explicit target annotations. +Records derived from pod annotations (for example hostname, internal hostname, `--pod-source-domain`, and compatibility annotations) are only generated when the pod `status.phase` is `Running`. +Pods that have not started or have terminated do not contribute annotation-based endpoints, including when they carry explicit target annotations. FQDN template expansion (`--fqdn-template`) is combined separately and still evaluates templates using the pod object as seen in the informer cache. From 12883ca4bbb1e273bfe720840fdd1ecc6eb276d1 Mon Sep 17 00:00:00 2001 From: Sumit Solanki Date: Mon, 4 May 2026 23:49:37 +0530 Subject: [PATCH 4/4] Refactore: Replaced early return with if/else for consistency Signed-off-by: Sumit Solanki --- source/pod.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/pod.go b/source/pod.go index 3efe76446d..14d069e45c 100644 --- a/source/pod.go +++ b/source/pod.go @@ -233,9 +233,9 @@ func (ps *podSource) addPodSourceDomainEndpoints(endpointMap map[endpoint.Endpoi domain := pod.Name + "." + ps.podSourceDomain if len(targets) == 0 { addToEndpointMap(endpointMap, pod, domain, endpoint.SuitableType(pod.Status.PodIP), pod.Status.PodIP) - return + } else { + addTargetsToEndpointMap(endpointMap, pod, targets, domain) } - addTargetsToEndpointMap(endpointMap, pod, targets, domain) } func (ps *podSource) addPodNodeEndpointsToEndpointMap(endpointMap map[endpoint.EndpointKey][]string, pod *v1.Pod, domainList []string) {