mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-07 18:16: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)
|
providerSpecific := getProviderSpecificAnnotations(ingressRoute.Annotations)
|
||||||
|
|
||||||
host := ingressRoute.Spec.VirtualHost.Fqdn
|
if virtualHost := ingressRoute.Spec.VirtualHost; virtualHost != nil {
|
||||||
if host != "" {
|
if fqdn := virtualHost.Fqdn; fqdn != "" {
|
||||||
endpoints = append(endpoints, endpointsForHostname(host, targets, ttl, providerSpecific)...)
|
endpoints = append(endpoints, endpointsForHostname(fqdn, targets, ttl, providerSpecific)...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip endpoints if we do not want entries from annotations
|
// Skip endpoints if we do not want entries from annotations
|
||||||
|
@ -234,6 +234,16 @@ func testEndpointsFromIngressRoute(t *testing.T) {
|
|||||||
ingressRoute: fakeIngressRoute{},
|
ingressRoute: fakeIngressRoute{},
|
||||||
expected: []*endpoint.Endpoint{},
|
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) {
|
t.Run(ti.title, func(t *testing.T) {
|
||||||
if source, err := newTestIngressRouteSource(ti.loadBalancer); err != nil {
|
if source, err := newTestIngressRouteSource(ti.loadBalancer); err != nil {
|
||||||
@ -1064,6 +1074,7 @@ type fakeIngressRoute struct {
|
|||||||
|
|
||||||
host string
|
host string
|
||||||
invalid bool
|
invalid bool
|
||||||
|
delegate bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ir fakeIngressRoute) IngressRoute() *contour.IngressRoute {
|
func (ir fakeIngressRoute) IngressRoute() *contour.IngressRoute {
|
||||||
@ -1074,17 +1085,24 @@ func (ir fakeIngressRoute) IngressRoute() *contour.IngressRoute {
|
|||||||
status = "valid"
|
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{
|
ingressRoute := &contour.IngressRoute{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Namespace: ir.namespace,
|
Namespace: ir.namespace,
|
||||||
Name: ir.name,
|
Name: ir.name,
|
||||||
Annotations: ir.annotations,
|
Annotations: ir.annotations,
|
||||||
},
|
},
|
||||||
Spec: contour.IngressRouteSpec{
|
Spec: spec,
|
||||||
VirtualHost: &contour.VirtualHost{
|
|
||||||
Fqdn: ir.host,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Status: contour.Status{
|
Status: contour.Status{
|
||||||
CurrentStatus: status,
|
CurrentStatus: status,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user