mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-07 10:06:57 +02:00
Support delegate Contour IngressRoutes
This commit is contained in:
parent
6c68e1bb24
commit
c0c3d25b45
@ -304,9 +304,10 @@ func (sc *ingressRouteSource) endpointsFromIngressRoute(ingressRoute *contourapi
|
||||
|
||||
providerSpecific := getProviderSpecificAnnotations(ingressRoute.Annotations)
|
||||
|
||||
host := ingressRoute.Spec.VirtualHost.Fqdn
|
||||
if host != "" {
|
||||
endpoints = append(endpoints, endpointsForHostname(host, targets, ttl, providerSpecific)...)
|
||||
if virtualHost := ingressRoute.Spec.VirtualHost; virtualHost != nil {
|
||||
if fqdn := virtualHost.Fqdn; fqdn != "" {
|
||||
endpoints = append(endpoints, endpointsForHostname(fqdn, targets, ttl, providerSpecific)...)
|
||||
}
|
||||
}
|
||||
|
||||
// Skip endpoints if we do not want entries from annotations
|
||||
|
@ -234,6 +234,16 @@ func testEndpointsFromIngressRoute(t *testing.T) {
|
||||
ingressRoute: fakeIngressRoute{},
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
{
|
||||
title: "delegate ingressroute",
|
||||
loadBalancer: fakeLoadBalancerService{
|
||||
hostnames: []string{"lb.com"},
|
||||
},
|
||||
ingressRoute: fakeIngressRoute{
|
||||
delegate: true,
|
||||
},
|
||||
expected: []*endpoint.Endpoint{},
|
||||
},
|
||||
} {
|
||||
t.Run(ti.title, func(t *testing.T) {
|
||||
if source, err := newTestIngressRouteSource(ti.loadBalancer); err != nil {
|
||||
@ -1064,6 +1074,7 @@ type fakeIngressRoute struct {
|
||||
|
||||
host string
|
||||
invalid bool
|
||||
delegate bool
|
||||
}
|
||||
|
||||
func (ir fakeIngressRoute) IngressRoute() *contour.IngressRoute {
|
||||
@ -1074,17 +1085,24 @@ func (ir fakeIngressRoute) IngressRoute() *contour.IngressRoute {
|
||||
status = "valid"
|
||||
}
|
||||
|
||||
var spec contour.IngressRouteSpec
|
||||
if ir.delegate {
|
||||
spec = contour.IngressRouteSpec{}
|
||||
} else {
|
||||
spec = contour.IngressRouteSpec{
|
||||
VirtualHost: &contour.VirtualHost{
|
||||
Fqdn: ir.host,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
ingressRoute := &contour.IngressRoute{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: ir.namespace,
|
||||
Name: ir.name,
|
||||
Annotations: ir.annotations,
|
||||
},
|
||||
Spec: contour.IngressRouteSpec{
|
||||
VirtualHost: &contour.VirtualHost{
|
||||
Fqdn: ir.host,
|
||||
},
|
||||
},
|
||||
Spec: spec,
|
||||
Status: contour.Status{
|
||||
CurrentStatus: status,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user