From 8c61a23f2faa31b4784168464edc81a8cf8deab3 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Wed, 21 Jan 2026 20:54:19 +0000 Subject: [PATCH 1/2] chore(ingress): clarify behavior with unit tests Signed-off-by: ivan katliarchuk --- source/ingress.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/ingress.go b/source/ingress.go index ccbf673d0b..af8e471d8d 100644 --- a/source/ingress.go +++ b/source/ingress.go @@ -317,6 +317,9 @@ func endpointsFromIngress(ing *networkv1.Ingress, ignoreHostnameAnnotation bool, return endpoints } +// targetsFromIngressStatus extracts targets from ingress load balancer status. +// Both IP and Hostname can be set simultaneously (Kubernetes API does not enforce +// mutual exclusivity), so we collect both when present. func targetsFromIngressStatus(status networkv1.IngressStatus) endpoint.Targets { var targets endpoint.Targets From aee630dad1fedc23ab170d0dda2c4ecf6097c998 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Thu, 22 Jan 2026 00:21:34 +0000 Subject: [PATCH 2/2] chore(ingress): clarify behavior with unit tests Signed-off-by: ivan katliarchuk --- source/ingress_test.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/source/ingress_test.go b/source/ingress_test.go index 41f27959e5..4cafd9ad45 100644 --- a/source/ingress_test.go +++ b/source/ingress_test.go @@ -1687,6 +1687,43 @@ func TestIngressWithConfiguration(t *testing.T) { }, }, }, + { + title: "no annotations, multiple ingresses, mixed IP and Hostname targets", + ingresses: []*networkv1.Ingress{ + { + ObjectMeta: metav1.ObjectMeta{ + Name: "my-ingress", + Namespace: "default", + }, + Spec: networkv1.IngressSpec{ + IngressClassName: testutils.ToPtr("alb"), + Rules: []networkv1.IngressRule{ + {Host: "app.example.com"}, + }, + }, + Status: networkv1.IngressStatus{ + LoadBalancer: networkv1.IngressLoadBalancerStatus{ + Ingress: []networkv1.IngressLoadBalancerIngress{ + {IP: "1.2.3.4"}, + {Hostname: "foo.tld"}, + }, + }, + }, + }, + }, + expected: []*endpoint.Endpoint{ + { + DNSName: "app.example.com", + RecordType: endpoint.RecordTypeA, + Targets: endpoint.Targets{"1.2.3.4"}, + }, + { + DNSName: "app.example.com", + RecordType: endpoint.RecordTypeCNAME, + Targets: endpoint.Targets{"foo.tld"}, + }, + }, + }, } { t.Run(tt.title, func(t *testing.T) { kubeClient := fake.NewClientset()