Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions source/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,64 @@ func TestIngressWithConfiguration(t *testing.T) {
{DNSName: "abc.example.com", Targets: endpoint.Targets{"1.2.3.4"}, RecordType: endpoint.RecordTypeA},
},
},
{
title: "multiple ingresses with same hostname, different CNAME targets and hostname annotation override",
ingresses: []*networkv1.Ingress{
{
ObjectMeta: metav1.ObjectMeta{
Name: "keycloak",
Namespace: "default",
Annotations: map[string]string{
annotations.HostnameKey: "keycloak.blah.com",
},
},
Spec: networkv1.IngressSpec{
Rules: []networkv1.IngressRule{
{Host: "keycloak.blah.com"},
},
},
Status: networkv1.IngressStatus{
LoadBalancer: networkv1.IngressLoadBalancerStatus{
Ingress: []networkv1.IngressLoadBalancerIngress{
{Hostname: "blah-1922533626.us-west-2.elb.amazonaws.com"},
},
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "keycloak-another",
Namespace: "default",
Annotations: map[string]string{
annotations.HostnameKey: "anotherkeycloak.blah.com",
},
},
Spec: networkv1.IngressSpec{
IngressClassName: testutils.ToPtr("alb"),
Rules: []networkv1.IngressRule{
{Host: "keycloak.blah.com"},
},
},
Status: networkv1.IngressStatus{
LoadBalancer: networkv1.IngressLoadBalancerStatus{
Ingress: []networkv1.IngressLoadBalancerIngress{
{Hostname: "blah-3488114.us-west-2.elb.amazonaws.com"},
},
},
},
},
},
expected: []*endpoint.Endpoint{
endpoint.NewEndpoint("keycloak.blah.com", endpoint.RecordTypeCNAME, "blah-1922533626.us-west-2.elb.amazonaws.com").
WithLabel(endpoint.ResourceLabelKey, "ingress/default/keycloak"),
endpoint.NewEndpoint("keycloak.blah.com", endpoint.RecordTypeCNAME, "blah-1922533626.us-west-2.elb.amazonaws.com").
WithLabel(endpoint.ResourceLabelKey, "ingress/default/keycloak"),
endpoint.NewEndpoint("keycloak.blah.com", endpoint.RecordTypeCNAME, "blah-3488114.us-west-2.elb.amazonaws.com").
WithLabel(endpoint.ResourceLabelKey, "ingress/default/keycloak-another"),
endpoint.NewEndpoint("anotherkeycloak.blah.com", endpoint.RecordTypeCNAME, "blah-3488114.us-west-2.elb.amazonaws.com").
WithLabel(endpoint.ResourceLabelKey, "ingress/default/keycloak-another"),
},
},
{
title: "ingress with when AWS ALB controller and NLB type generates two targets for CNAME",
ingresses: []*networkv1.Ingress{
Expand Down
Loading