From 76a2ea17aa0ecb51c33b113f7f30effd5cf443d8 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Thu, 28 Sep 2023 22:23:30 -0700 Subject: [PATCH 01/10] Make --ignore-hostname-annotation flag more consistent --- docs/annotations/annotations.md | 4 +- source/kong_tcpingress.go | 36 ++-- source/kong_tcpingress_test.go | 72 +++++++- source/store.go | 4 +- source/traefik_proxy.go | 28 +-- source/traefik_proxy_test.go | 298 ++++++++++++++++++++++++++++---- 6 files changed, 377 insertions(+), 65 deletions(-) diff --git a/docs/annotations/annotations.md b/docs/annotations/annotations.md index 6f54dd4db..d9f4c335d 100644 --- a/docs/annotations/annotations.md +++ b/docs/annotations/annotations.md @@ -16,13 +16,13 @@ The following table documents which sources support which annotations: | Gloo | | | | Yes | Yes[^5] | Yes[^5] | | Ingress | Yes | Yes[^1] | | Yes | Yes | Yes | | Istio | Yes | Yes[^1] | | Yes | Yes | Yes | -| Kong | | Yes | | Yes | Yes | Yes | +| Kong | | Yes[^1] | | Yes | Yes | Yes | | Node | Yes | | | Yes | Yes | | | OpenShift | Yes | Yes[^1] | | Yes | Yes | Yes | | Pod | | Yes | Yes | Yes | | | | Service | Yes | Yes[^1] | Yes[^1][^2] | Yes[^3] | Yes | Yes | | Skipper | Yes | Yes[^1] | | Yes | Yes | Yes | -| Traefik | | Yes | | Yes | Yes | Yes | +| Traefik | | Yes[^1] | | Yes | Yes | Yes | [^1]: Unless the `--ignore-hostname-annotation` flag is specified. [^2]: Only behaves differently than `hostname` for `Service`s of type `ClusterIP` or `LoadBalancer`. diff --git a/source/kong_tcpingress.go b/source/kong_tcpingress.go index fbd8dba93..0138efb30 100644 --- a/source/kong_tcpingress.go +++ b/source/kong_tcpingress.go @@ -47,16 +47,17 @@ var kongGroupdVersionResource = schema.GroupVersionResource{ // kongTCPIngressSource is an implementation of Source for Kong TCPIngress objects. type kongTCPIngressSource struct { - annotationFilter string - dynamicKubeClient dynamic.Interface - kongTCPIngressInformer informers.GenericInformer - kubeClient kubernetes.Interface - namespace string - unstructuredConverter *unstructuredConverter + annotationFilter string + ignoreHostnameAnnotation bool + dynamicKubeClient dynamic.Interface + kongTCPIngressInformer informers.GenericInformer + kubeClient kubernetes.Interface + namespace string + unstructuredConverter *unstructuredConverter } // NewKongTCPIngressSource creates a new kongTCPIngressSource with the given config. -func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string) (Source, error) { +func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string, ignoreHostnameAnnotation bool) (Source, error) { var err error // Use shared informer to listen for add/update/delete of Host in the specified namespace. @@ -85,12 +86,13 @@ func NewKongTCPIngressSource(ctx context.Context, dynamicKubeClient dynamic.Inte } return &kongTCPIngressSource{ - annotationFilter: annotationFilter, - dynamicKubeClient: dynamicKubeClient, - kongTCPIngressInformer: kongTCPIngressInformer, - kubeClient: kubeClient, - namespace: namespace, - unstructuredConverter: uc, + annotationFilter: annotationFilter, + ignoreHostnameAnnotation: ignoreHostnameAnnotation, + dynamicKubeClient: dynamicKubeClient, + kongTCPIngressInformer: kongTCPIngressInformer, + kubeClient: kubeClient, + namespace: namespace, + unstructuredConverter: uc, }, nil } @@ -210,9 +212,11 @@ func (sc *kongTCPIngressSource) endpointsFromTCPIngress(tcpIngress *TCPIngress, providerSpecific, setIdentifier := getProviderSpecificAnnotations(tcpIngress.Annotations) - hostnameList := getHostnamesFromAnnotations(tcpIngress.Annotations) - for _, hostname := range hostnameList { - endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + if !sc.ignoreHostnameAnnotation { + hostnameList := getHostnamesFromAnnotations(tcpIngress.Annotations) + for _, hostname := range hostnameList { + endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + } } if tcpIngress.Spec.Rules != nil { diff --git a/source/kong_tcpingress_test.go b/source/kong_tcpingress_test.go index bb3db2c65..8f8100e3d 100644 --- a/source/kong_tcpingress_test.go +++ b/source/kong_tcpingress_test.go @@ -40,9 +40,10 @@ func TestKongTCPIngressEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - tcpProxy TCPIngress - expected []*endpoint.Endpoint + title string + tcpProxy TCPIngress + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "TCPIngress with hostname annotation", @@ -220,6 +221,67 @@ func TestKongTCPIngressEndpoints(t *testing.T) { }, }, }, + { + title: "TCPIngress ignoring hostname annotation", + tcpProxy: TCPIngress{ + TypeMeta: metav1.TypeMeta{ + APIVersion: kongGroupdVersionResource.GroupVersion().String(), + Kind: "TCPIngress", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "tcp-ingress-both", + Namespace: defaultKongNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "d.example.com", + "kubernetes.io/ingress.class": "kong", + }, + }, + Spec: tcpIngressSpec{ + Rules: []tcpIngressRule{ + { + Port: 30004, + Host: "e.example.com", + }, + { + Port: 30005, + Host: "f.example.com", + }, + }, + }, + Status: tcpIngressStatus{ + LoadBalancer: corev1.LoadBalancerStatus{ + Ingress: []corev1.LoadBalancerIngress{ + { + Hostname: "a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com", + }, + }, + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: []*endpoint.Endpoint{ + { + DNSName: "e.example.com", + Targets: []string{"a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "tcpingress/kong/tcp-ingress-both", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + { + DNSName: "f.example.com", + Targets: []string{"a12e71861a4303f063456769a314a3bd-1291189659.us-east-1.elb.amazonaws.com"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "tcpingress/kong/tcp-ingress-both", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + }, + }, { title: "TCPIngress with target annotation", tcpProxy: TCPIngress{ @@ -300,7 +362,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(kongGroupdVersionResource).Namespace(defaultKongNamespace).Create(context.Background(), &tcpi, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewKongTCPIngressSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultKongNamespace, "kubernetes.io/ingress.class=kong") + source, err := NewKongTCPIngressSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultKongNamespace, "kubernetes.io/ingress.class=kong", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -312,7 +374,7 @@ func TestKongTCPIngressEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } diff --git a/source/store.go b/source/store.go index 3599390e8..5f6b9dc35 100644 --- a/source/store.go +++ b/source/store.go @@ -300,7 +300,7 @@ func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg if err != nil { return nil, err } - return NewTraefikSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter) + return NewTraefikSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter, cfg.IgnoreHostnameAnnotation) case "openshift-route": ocpClient, err := p.OpenShiftClient() if err != nil { @@ -341,7 +341,7 @@ func BuildWithConfig(ctx context.Context, source string, p ClientGenerator, cfg if err != nil { return nil, err } - return NewKongTCPIngressSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter) + return NewKongTCPIngressSource(ctx, dynamicClient, kubernetesClient, cfg.Namespace, cfg.AnnotationFilter, cfg.IgnoreHostnameAnnotation) case "f5-virtualserver": kubernetesClient, err := p.KubeClient() if err != nil { diff --git a/source/traefik_proxy.go b/source/traefik_proxy.go index 2050cb7ce..d9140c640 100644 --- a/source/traefik_proxy.go +++ b/source/traefik_proxy.go @@ -80,6 +80,7 @@ var ( type traefikSource struct { annotationFilter string + ignoreHostnameAnnotation bool dynamicKubeClient dynamic.Interface ingressRouteInformer informers.GenericInformer ingressRouteTcpInformer informers.GenericInformer @@ -92,7 +93,7 @@ type traefikSource struct { unstructuredConverter *unstructuredConverter } -func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string) (Source, error) { +func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface, kubeClient kubernetes.Interface, namespace string, annotationFilter string, ignoreHostnameAnnotation bool) (Source, error) { // Use shared informer to listen for add/update/delete of Host in the specified namespace. // Set resync period to 0, to prevent processing when nothing has changed. informerFactory := dynamicinformer.NewFilteredDynamicSharedInformerFactory(dynamicKubeClient, 0, namespace, nil) @@ -149,6 +150,7 @@ func NewTraefikSource(ctx context.Context, dynamicKubeClient dynamic.Interface, return &traefikSource{ annotationFilter: annotationFilter, + ignoreHostnameAnnotation: ignoreHostnameAnnotation, dynamicKubeClient: dynamicKubeClient, ingressRouteInformer: ingressRouteInformer, ingressRouteTcpInformer: ingressRouteTcpInformer, @@ -653,9 +655,11 @@ func (ts *traefikSource) endpointsFromIngressRoute(ingressRoute *IngressRoute, t providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations) - hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) - for _, hostname := range hostnameList { - endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + if !ts.ignoreHostnameAnnotation { + hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) + for _, hostname := range hostnameList { + endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + } } for _, route := range ingressRoute.Spec.Routes { @@ -687,9 +691,11 @@ func (ts *traefikSource) endpointsFromIngressRouteTCP(ingressRoute *IngressRoute providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations) - hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) - for _, hostname := range hostnameList { - endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + if !ts.ignoreHostnameAnnotation { + hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) + for _, hostname := range hostnameList { + endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + } } for _, route := range ingressRoute.Spec.Routes { @@ -722,9 +728,11 @@ func (ts *traefikSource) endpointsFromIngressRouteUDP(ingressRoute *IngressRoute providerSpecific, setIdentifier := getProviderSpecificAnnotations(ingressRoute.Annotations) - hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) - for _, hostname := range hostnameList { - endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + if !ts.ignoreHostnameAnnotation { + hostnameList := getHostnamesFromAnnotations(ingressRoute.Annotations) + for _, hostname := range hostnameList { + endpoints = append(endpoints, endpointsForHostname(hostname, targets, ttl, providerSpecific, setIdentifier, resource)...) + } } return endpoints, nil diff --git a/source/traefik_proxy_test.go b/source/traefik_proxy_test.go index eb26ed2b3..4905bb0b7 100644 --- a/source/traefik_proxy_test.go +++ b/source/traefik_proxy_test.go @@ -39,9 +39,10 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRoute IngressRoute - expected []*endpoint.Endpoint + title string + ingressRoute IngressRoute + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRoute with hostname annotation", @@ -248,6 +249,54 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRoute ignoring annotation", + ingressRoute: IngressRoute{ + TypeMeta: metav1.TypeMeta{ + APIVersion: ingressrouteGVR.GroupVersion().String(), + Kind: "IngressRoute", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressroute-multi-host-annotations-match", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "f.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + Spec: traefikIngressRouteSpec{ + Routes: []traefikRoute{ + { + Match: "Host(`g.example.com`, `h.example.com`)", + }, + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: []*endpoint.Endpoint{ + { + DNSName: "g.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + { + DNSName: "h.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + }, + }, { title: "IngressRoute omit wildcard", ingressRoute: IngressRoute{ @@ -299,7 +348,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(ingressrouteGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -311,7 +360,7 @@ func TestTraefikProxyIngressRouteEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } @@ -320,9 +369,10 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRouteTCP IngressRouteTCP - expected []*endpoint.Endpoint + title string + ingressRouteTCP IngressRouteTCP + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRouteTCP with hostname annotation", @@ -493,6 +543,54 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRouteTCP ignoring annotation", + ingressRouteTCP: IngressRouteTCP{ + TypeMeta: metav1.TypeMeta{ + APIVersion: ingressrouteTCPGVR.GroupVersion().String(), + Kind: "IngressRouteTCP", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressroutetcp-multi-host-annotations-match", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "f.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + Spec: traefikIngressRouteTCPSpec{ + Routes: []traefikRouteTCP{ + { + Match: "HostSNI(`g.example.com`, `h.example.com`)", + }, + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: []*endpoint.Endpoint{ + { + DNSName: "g.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + { + DNSName: "h.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + }, + }, { title: "IngressRouteTCP omit wildcard host sni", ingressRouteTCP: IngressRouteTCP{ @@ -544,7 +642,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(ingressrouteTCPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -556,7 +654,7 @@ func TestTraefikProxyIngressRouteTCPEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } @@ -565,9 +663,10 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRouteUDP IngressRouteUDP - expected []*endpoint.Endpoint + title string + ingressRouteUDP IngressRouteUDP + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRouteTCP with hostname annotation", @@ -639,6 +738,26 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRouteTCP ignoring hostname annotation", + ingressRouteUDP: IngressRouteUDP{ + TypeMeta: metav1.TypeMeta{ + APIVersion: ingressrouteUDPGVR.GroupVersion().String(), + Kind: "IngressRouteUDP", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressrouteudp-annotation", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "a.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: nil, + }, } { ti := ti t.Run(ti.title, func(t *testing.T) { @@ -665,7 +784,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(ingressrouteUDPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -677,7 +796,7 @@ func TestTraefikProxyIngressRouteUDPEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } @@ -686,9 +805,10 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRoute IngressRoute - expected []*endpoint.Endpoint + title string + ingressRoute IngressRoute + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRoute with hostname annotation", @@ -895,6 +1015,54 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRoute ignoring annotation", + ingressRoute: IngressRoute{ + TypeMeta: metav1.TypeMeta{ + APIVersion: oldIngressrouteGVR.GroupVersion().String(), + Kind: "IngressRoute", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressroute-multi-host-annotations-match", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "f.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + Spec: traefikIngressRouteSpec{ + Routes: []traefikRoute{ + { + Match: "Host(`g.example.com`, `h.example.com`)", + }, + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: []*endpoint.Endpoint{ + { + DNSName: "g.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + { + DNSName: "h.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroute/traefik/ingressroute-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + }, + }, { title: "IngressRoute omit wildcard", ingressRoute: IngressRoute{ @@ -946,7 +1114,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(oldIngressrouteGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -958,7 +1126,7 @@ func TestTraefikProxyOldIngressRouteEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } @@ -967,9 +1135,10 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRouteTCP IngressRouteTCP - expected []*endpoint.Endpoint + title string + ingressRouteTCP IngressRouteTCP + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRouteTCP with hostname annotation", @@ -1140,6 +1309,54 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRouteTCP ignoring annotation", + ingressRouteTCP: IngressRouteTCP{ + TypeMeta: metav1.TypeMeta{ + APIVersion: oldIngressrouteTCPGVR.GroupVersion().String(), + Kind: "IngressRouteTCP", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressroutetcp-multi-host-annotations-match", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "f.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + Spec: traefikIngressRouteTCPSpec{ + Routes: []traefikRouteTCP{ + { + Match: "HostSNI(`g.example.com`, `h.example.com`)", + }, + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: []*endpoint.Endpoint{ + { + DNSName: "g.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + { + DNSName: "h.example.com", + Targets: []string{"target.domain.tld"}, + RecordType: endpoint.RecordTypeCNAME, + RecordTTL: 0, + Labels: endpoint.Labels{ + "resource": "ingressroutetcp/traefik/ingressroutetcp-multi-host-annotations-match", + }, + ProviderSpecific: endpoint.ProviderSpecific{}, + }, + }, + }, { title: "IngressRouteTCP omit wildcard host sni", ingressRouteTCP: IngressRouteTCP{ @@ -1191,7 +1408,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(oldIngressrouteTCPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -1203,7 +1420,7 @@ func TestTraefikProxyOldIngressRouteTCPEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } @@ -1212,9 +1429,10 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) { t.Parallel() for _, ti := range []struct { - title string - ingressRouteUDP IngressRouteUDP - expected []*endpoint.Endpoint + title string + ingressRouteUDP IngressRouteUDP + ignoreHostnameAnnotation bool + expected []*endpoint.Endpoint }{ { title: "IngressRouteTCP with hostname annotation", @@ -1286,6 +1504,26 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) { }, }, }, + { + title: "IngressRouteTCP ignoring hostname annotation", + ingressRouteUDP: IngressRouteUDP{ + TypeMeta: metav1.TypeMeta{ + APIVersion: oldIngressrouteUDPGVR.GroupVersion().String(), + Kind: "IngressRouteUDP", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: "ingressrouteudp-annotation", + Namespace: defaultTraefikNamespace, + Annotations: map[string]string{ + "external-dns.alpha.kubernetes.io/hostname": "a.example.com", + "external-dns.alpha.kubernetes.io/target": "target.domain.tld", + "kubernetes.io/ingress.class": "traefik", + }, + }, + }, + ignoreHostnameAnnotation: true, + expected: nil, + }, } { ti := ti t.Run(ti.title, func(t *testing.T) { @@ -1312,7 +1550,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) { _, err = fakeDynamicClient.Resource(oldIngressrouteUDPGVR).Namespace(defaultTraefikNamespace).Create(context.Background(), &ir, metav1.CreateOptions{}) assert.NoError(t, err) - source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik") + source, err := NewTraefikSource(context.TODO(), fakeDynamicClient, fakeKubernetesClient, defaultTraefikNamespace, "kubernetes.io/ingress.class=traefik", ti.ignoreHostnameAnnotation) assert.NoError(t, err) assert.NotNil(t, source) @@ -1324,7 +1562,7 @@ func TestTraefikProxyOldIngressRouteUDPEndpoints(t *testing.T) { endpoints, err := source.Endpoints(context.Background()) assert.NoError(t, err) assert.Len(t, endpoints, len(ti.expected)) - assert.Equal(t, endpoints, ti.expected) + assert.Equal(t, ti.expected, endpoints) }) } } From 8cd595fef8938bfd6d3b836e2927c23d4f6c26e6 Mon Sep 17 00:00:00 2001 From: Kundan Kumar Date: Tue, 18 Jul 2023 18:16:18 +0530 Subject: [PATCH 02/10] updated various broken link in ultradns tutorial --- docs/tutorials/ultradns.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tutorials/ultradns.md b/docs/tutorials/ultradns.md index 50d98cf6c..b339e836e 100644 --- a/docs/tutorials/ultradns.md +++ b/docs/tutorials/ultradns.md @@ -6,7 +6,7 @@ For this tutorial, please make sure that you are using a version **> 0.7.2** of ## Managing DNS with UltraDNS -If you would like to read-up on the UltraDNS service, you can find additional details here: [Introduction to UltraDNS](https://docs.ultradns.neustar) +If you would like to read-up on the UltraDNS service, you can find additional details here: [Introduction to UltraDNS](https://docs.ultradns.com/) Before proceeding, please create a new DNS Zone that you will create your records in for this tutorial process. For the examples in this tutorial, we will be using `example.com` as our Zone. @@ -191,9 +191,9 @@ Once the service has an external IP assigned, ExternalDNS will notice the new se ## Verifying UltraDNS Records -Please verify on the [UltraDNS UI](https://portal.ultradns.neustar) that the records are created under the zone "example.com". +Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records are created under the zone "example.com". -For more information on UltraDNS UI, refer to (https://docs.ultradns.neustar/mspuserguide.html). +For more information on UltraDNS UI, refer to (https://docs.ultradns.com/Content/MSP_User_Guide/Content/User%20Guides/MSP_User_Guide/Navigation/Moving%20Around%20the%20UI.htm#_Toc2780722). Select the zone that was created above (or select the appropriate zone if a different zone was used.) @@ -265,7 +265,7 @@ $ kubectl create -f expose-apple-banana-app.yaml $ kubectl create -f external-dns.yaml ``` - Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service. -- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar) that the records have been created under the zone "example.com". +- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login) that the records have been created under the zone "example.com". - Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com": ```console $ kubectl delete -f apple-banana-echo.yaml @@ -358,7 +358,7 @@ $ kubectl create -f apple-banana-echo.yaml $ kubectl create -f external-dns.yaml ``` - Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service. -- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar), that the records have been created under the zone "example.com". +- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com". - Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com": ```console $ kubectl delete -f apple-banana-echo.yaml @@ -629,7 +629,7 @@ $ kubectl create -f apple-banana-echo.yaml $ kubectl create -f external-dns.yaml ``` - Depending on where you run your service from, it can take a few minutes for your cloud provider to create an external IP for the service. -- Please verify on the [UltraDNS UI](https://portal.ultradns.neustar), that the records have been created under the zone "example.com". +- Please verify on the [UltraDNS UI](https://portal.ultradns.com/login), that the records have been created under the zone "example.com". - Finally, you will need to clean up the deployment and service. Please verify on the UI afterwards that the records have been deleted from the zone "example.com": ```console $ kubectl delete -f apple-banana-echo.yaml From 42aaa58232d898db56527cbd91492c136668a379 Mon Sep 17 00:00:00 2001 From: Timofey Titovets Date: Tue, 10 Oct 2023 14:02:55 +0200 Subject: [PATCH 03/10] fix(httpProxy): drop status==valid filter --- source/contour_httpproxy.go | 8 -------- source/contour_httpproxy_test.go | 17 ----------------- 2 files changed, 25 deletions(-) diff --git a/source/contour_httpproxy.go b/source/contour_httpproxy.go index 818646e42..fb028dc64 100644 --- a/source/contour_httpproxy.go +++ b/source/contour_httpproxy.go @@ -140,9 +140,6 @@ func (sc *httpProxySource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, log.Debugf("Skipping HTTPProxy %s/%s because controller value does not match, found: %s, required: %s", hp.Namespace, hp.Name, controller, controllerAnnotationValue) continue - } else if hp.Status.CurrentStatus != "valid" { - log.Debugf("Skipping HTTPProxy %s/%s because it is not valid", hp.Namespace, hp.Name) - continue } hpEndpoints, err := sc.endpointsFromHTTPProxy(hp) @@ -244,11 +241,6 @@ func (sc *httpProxySource) filterByAnnotations(httpProxies []*projectcontour.HTT // endpointsFromHTTPProxyConfig extracts the endpoints from a Contour HTTPProxy object func (sc *httpProxySource) endpointsFromHTTPProxy(httpProxy *projectcontour.HTTPProxy) ([]*endpoint.Endpoint, error) { - if httpProxy.Status.CurrentStatus != "valid" { - log.Warn(errors.Errorf("cannot generate endpoints for HTTPProxy with status %s", httpProxy.Status.CurrentStatus)) - return nil, nil - } - resource := fmt.Sprintf("HTTPProxy/%s/%s", httpProxy.Namespace, httpProxy.Name) ttl := getTTLFromAnnotations(httpProxy.Annotations, resource) diff --git a/source/contour_httpproxy_test.go b/source/contour_httpproxy_test.go index e90bd059a..f26d2b029 100644 --- a/source/contour_httpproxy_test.go +++ b/source/contour_httpproxy_test.go @@ -269,14 +269,6 @@ func testEndpointsFromHTTPProxy(t *testing.T) { httpProxy: fakeHTTPProxy{}, expected: []*endpoint.Endpoint{}, }, - { - title: "one rule.host invalid httpproxy", - httpProxy: fakeHTTPProxy{ - host: "foo.bar", - invalid: true, - }, - expected: []*endpoint.Endpoint{}, - }, { title: "no targets", httpProxy: fakeHTTPProxy{}, @@ -1114,19 +1106,11 @@ type fakeHTTPProxy struct { annotations map[string]string host string - invalid bool delegate bool loadBalancer fakeLoadBalancerService } func (ir fakeHTTPProxy) HTTPProxy() *projectcontour.HTTPProxy { - var status string - if ir.invalid { - status = "invalid" - } else { - status = "valid" - } - var spec projectcontour.HTTPProxySpec if ir.delegate { spec = projectcontour.HTTPProxySpec{} @@ -1161,7 +1145,6 @@ func (ir fakeHTTPProxy) HTTPProxy() *projectcontour.HTTPProxy { }, Spec: spec, Status: projectcontour.HTTPProxyStatus{ - CurrentStatus: status, LoadBalancer: lb, }, } From d7b0dfd781def4f8e934ac75c59a8de4a6f8b25b Mon Sep 17 00:00:00 2001 From: Nandor Galambosi Date: Sat, 14 Oct 2023 15:31:46 +0200 Subject: [PATCH 04/10] service source uses externalIPs in ExternalName type if available --- docs/sources/service.md | 3 ++- source/service.go | 3 +++ source/service_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/sources/service.md b/docs/sources/service.md index 9a1871c7b..c112408d0 100644 --- a/docs/sources/service.md +++ b/docs/sources/service.md @@ -106,5 +106,6 @@ as one of the values. ### ExternalName -Creates a target with the value of the Service's `externalName` field. +1. If the Service has one or more `spec.externalIPs`, uses the values in that field. +2. Otherwise, creates a target with the value of the Service's `externalName` field. diff --git a/source/service.go b/source/service.go index db7247902..df9b3a886 100644 --- a/source/service.go +++ b/source/service.go @@ -555,6 +555,9 @@ func extractServiceIps(svc *v1.Service) endpoint.Targets { } func extractServiceExternalName(svc *v1.Service) endpoint.Targets { + if len(svc.Spec.ExternalIPs) > 0 { + return svc.Spec.ExternalIPs + } return endpoint.Targets{svc.Spec.ExternalName} } diff --git a/source/service_test.go b/source/service_test.go index 13c029d59..724bcd4c6 100644 --- a/source/service_test.go +++ b/source/service_test.go @@ -3545,6 +3545,7 @@ func TestExternalServices(t *testing.T) { labels map[string]string annotations map[string]string externalName string + externalIPs []string expected []*endpoint.Endpoint expectError bool }{ @@ -3562,6 +3563,7 @@ func TestExternalServices(t *testing.T) { hostnameAnnotationKey: "service.example.org", }, "111.111.111.111", + []string{}, []*endpoint.Endpoint{ {DNSName: "service.example.org", Targets: endpoint.Targets{"111.111.111.111"}, RecordType: endpoint.RecordTypeA}, }, @@ -3581,6 +3583,7 @@ func TestExternalServices(t *testing.T) { hostnameAnnotationKey: "service.example.org", }, "2001:db8::111", + []string{}, []*endpoint.Endpoint{ {DNSName: "service.example.org", Targets: endpoint.Targets{"2001:db8::111"}, RecordType: endpoint.RecordTypeAAAA}, }, @@ -3600,11 +3603,32 @@ func TestExternalServices(t *testing.T) { hostnameAnnotationKey: "service.example.org", }, "remote.example.com", + []string{}, []*endpoint.Endpoint{ {DNSName: "service.example.org", Targets: endpoint.Targets{"remote.example.com"}, RecordType: endpoint.RecordTypeCNAME}, }, false, }, + { + "annotated ExternalName service with externalIPs returns a single endpoint with multiple targets", + "", + "testing", + "foo", + v1.ServiceTypeExternalName, + "", + "", + false, + map[string]string{"component": "foo"}, + map[string]string{ + hostnameAnnotationKey: "service.example.org", + }, + "service.example.org", + []string{"10.2.3.4", "11.2.3.4"}, + []*endpoint.Endpoint{ + {DNSName: "service.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{"10.2.3.4", "11.2.3.4"}}, + }, + false, + }, } { tc := tc t.Run(tc.title, func(t *testing.T) { @@ -3617,6 +3641,7 @@ func TestExternalServices(t *testing.T) { Spec: v1.ServiceSpec{ Type: tc.svcType, ExternalName: tc.externalName, + ExternalIPs: tc.externalIPs, }, ObjectMeta: metav1.ObjectMeta{ Namespace: tc.svcNamespace, From 04e92c55564ec074b5d78fd47e86eb76206b9f49 Mon Sep 17 00:00:00 2001 From: Nandor Galambosi Date: Thu, 9 Nov 2023 21:48:36 +0100 Subject: [PATCH 05/10] Testcase for dualstack externalIPs added --- source/service_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/service_test.go b/source/service_test.go index 724bcd4c6..18c49a21f 100644 --- a/source/service_test.go +++ b/source/service_test.go @@ -3629,6 +3629,27 @@ func TestExternalServices(t *testing.T) { }, false, }, + { + "annotated ExternalName service with externalIPs of dualstack addresses returns 2 endpoints with multiple targets", + "", + "testing", + "foo", + v1.ServiceTypeExternalName, + "", + "", + false, + map[string]string{"component": "foo"}, + map[string]string{ + hostnameAnnotationKey: "service.example.org", + }, + "service.example.org", + []string{"10.2.3.4", "11.2.3.4", "2001:db8::1", "2001:db8::2"}, + []*endpoint.Endpoint{ + {DNSName: "service.example.org", RecordType: endpoint.RecordTypeA, Targets: endpoint.Targets{"10.2.3.4", "11.2.3.4"}}, + {DNSName: "service.example.org", RecordType: endpoint.RecordTypeAAAA, Targets: endpoint.Targets{"2001:db8::1", "2001:db8::2"}}, + }, + false, + }, } { tc := tc t.Run(tc.title, func(t *testing.T) { From 2a9196fa69569ef75ca516ca67b0ce71e3f39656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Fri, 10 Nov 2023 16:49:38 +0100 Subject: [PATCH 06/10] chore: Bump kingpin/v2 dep --- go.mod | 4 ++-- go.sum | 7 ++++--- pkg/apis/externaldns/types.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9a471beee..df2bc7bf7 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/IBM/go-sdk-core/v5 v5.13.4 github.com/IBM/networking-go-sdk v0.42.2 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 - github.com/alecthomas/kingpin v2.2.6+incompatible + github.com/alecthomas/kingpin/v2 v2.3.2 github.com/aliyun/alibaba-cloud-sdk-go v1.62.483 github.com/ans-group/sdk-go v1.16.6 github.com/aws/aws-sdk-go v1.44.311 @@ -87,7 +87,6 @@ require ( github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect github.com/Masterminds/semver v1.4.2 // indirect github.com/Yamashou/gqlgenc v0.14.0 // indirect - github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/alexbrainman/sspi v0.0.0-20180613141037-e580b900e9f5 // indirect github.com/ans-group/go-durationstring v1.2.0 // indirect @@ -181,6 +180,7 @@ require ( github.com/subosito/gotenv v1.4.2 // indirect github.com/terra-farm/udnssdk v1.3.5 // indirect github.com/vektah/gqlparser/v2 v2.5.1 // indirect + github.com/xhit/go-str2duration/v2 v2.1.0 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect go.mongodb.org/mongo-driver v1.11.3 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/go.sum b/go.sum index fcb776718..ec8554554 100644 --- a/go.sum +++ b/go.sum @@ -112,10 +112,9 @@ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 h1:F1j7z+/DKEsYqZNoxC6wvfmaiDneLsQOFQmuq9NADSY= github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2/go.mod h1:QlXr/TrICfQ/ANa76sLeQyhAJyNR9sEcfNuZBkY9jgY= -github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI= -github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE= +github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWrKI6ocU= +github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -1162,6 +1161,8 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= +github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/handysort v0.0.0-20150421192137-fb3537ed64a1/go.mod h1:QcJo0QPSfTONNIgpN5RA8prR7fF8nkF6cTWTcNerRO8= diff --git a/pkg/apis/externaldns/types.go b/pkg/apis/externaldns/types.go index b2f69efe3..5d65704c7 100644 --- a/pkg/apis/externaldns/types.go +++ b/pkg/apis/externaldns/types.go @@ -28,7 +28,7 @@ import ( "sigs.k8s.io/external-dns/endpoint" - "github.com/alecthomas/kingpin" + "github.com/alecthomas/kingpin/v2" "github.com/sirupsen/logrus" "sigs.k8s.io/external-dns/source" From 5b5d68f45a6888d195872620b5093839e4c057c1 Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Sat, 11 Nov 2023 17:15:49 +0100 Subject: [PATCH 07/10] updates all versions in documentation Signed-off-by: Raffaele Di Fazio --- docs/faq.md | 2 +- docs/release.md | 2 +- docs/tutorials/ANS_Group_SafeDNS.md | 4 ++-- docs/tutorials/akamai-edgedns.md | 4 ++-- docs/tutorials/alibabacloud.md | 4 ++-- docs/tutorials/aws-sd.md | 4 ++-- docs/tutorials/aws.md | 6 +++--- docs/tutorials/azure-private-dns.md | 6 +++--- docs/tutorials/azure.md | 6 +++--- docs/tutorials/bluecat.md | 4 ++-- docs/tutorials/civo.md | 4 ++-- docs/tutorials/cloudflare.md | 4 ++-- docs/tutorials/contour.md | 4 ++-- docs/tutorials/coredns.md | 4 ++-- docs/tutorials/designate.md | 4 ++-- docs/tutorials/digitalocean.md | 4 ++-- docs/tutorials/dnsimple.md | 4 ++-- docs/tutorials/dyn.md | 2 +- docs/tutorials/exoscale.md | 2 +- docs/tutorials/externalname.md | 2 +- docs/tutorials/gandi.md | 4 ++-- docs/tutorials/gateway-api.md | 2 +- docs/tutorials/gke.md | 2 +- docs/tutorials/gloo-proxy.md | 4 ++-- docs/tutorials/godaddy.md | 4 ++-- docs/tutorials/hostport.md | 4 ++-- docs/tutorials/ibmcloud.md | 4 ++-- docs/tutorials/infoblox.md | 4 ++-- docs/tutorials/istio.md | 4 ++-- docs/tutorials/kong.md | 4 ++-- docs/tutorials/linode.md | 4 ++-- docs/tutorials/nginx-ingress.md | 4 ++-- docs/tutorials/nodes.md | 4 ++-- docs/tutorials/ns1.md | 4 ++-- docs/tutorials/openshift.md | 4 ++-- docs/tutorials/oracle.md | 2 +- docs/tutorials/ovh.md | 4 ++-- docs/tutorials/pdns.md | 2 +- docs/tutorials/pihole.md | 2 +- docs/tutorials/plural.md | 4 ++-- docs/tutorials/public-private-route53.md | 4 ++-- docs/tutorials/rcodezero.md | 4 ++-- docs/tutorials/rdns.md | 4 ++-- docs/tutorials/rfc2136.md | 4 ++-- docs/tutorials/scaleway.md | 4 ++-- docs/tutorials/security-context.md | 2 +- docs/tutorials/tencentcloud.md | 2 +- docs/tutorials/traefik-proxy.md | 4 ++-- docs/tutorials/transip.md | 4 ++-- docs/tutorials/ultradns.md | 4 ++-- docs/tutorials/vinyldns.md | 4 ++-- docs/tutorials/vultr.md | 4 ++-- 52 files changed, 95 insertions(+), 95 deletions(-) diff --git a/docs/faq.md b/docs/faq.md index 73ed9faad..ff85955a6 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -209,7 +209,7 @@ $ docker run \ -e EXTERNAL_DNS_SOURCE=$'service\ningress' \ -e EXTERNAL_DNS_PROVIDER=google \ -e EXTERNAL_DNS_DOMAIN_FILTER=$'foo.com\nbar.com' \ - registry.k8s.io/external-dns/external-dns:v0.13.5 + registry.k8s.io/external-dns/external-dns:v0.14.0 time="2017-08-08T14:10:26Z" level=info msg="config: &{APIServerURL: KubeConfig: Sources:[service ingress] Namespace: ... ``` diff --git a/docs/release.md b/docs/release.md index de37dce59..5883f0672 100644 --- a/docs/release.md +++ b/docs/release.md @@ -31,7 +31,7 @@ You must be an official maintainer of the project to be able to do a release. - Branch out from the default branch and run `scripts/kustomize-version-updater.sh` to update the image tag used in the kustomization.yaml. - Create an issue to release the corresponding Helm chart via the chart release process (below) assigned to a chart maintainer - Create a PR with the kustomize change. -- Create a PR to replace all versions for docker images in the tutorials. A possible script to use is `sd registry.k8s.io/external-dns/external-dns:.* registry.k8s.io/external-dns/external-dns:v0.13.2 $(fd --type file)` which uses the `fd` and `sd` utilities. +- Create a PR to replace all versions for docker images in the tutorials. A possible script to use is `sd registry.k8s.io/external-dns/external-dns:v0.14.0 - Once the PR is merged, all is done :-) ## How to release a new chart version diff --git a/docs/tutorials/ANS_Group_SafeDNS.md b/docs/tutorials/ANS_Group_SafeDNS.md index 92450495b..f440b927f 100644 --- a/docs/tutorials/ANS_Group_SafeDNS.md +++ b/docs/tutorials/ANS_Group_SafeDNS.md @@ -48,7 +48,7 @@ spec: - name: external-dns # You will need to check what the latest version is yourself: # https://github.com/kubernetes-sigs/external-dns/releases - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible # (optional) limit to only example.com domains; change to match the @@ -114,7 +114,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible # (optional) limit to only example.com domains; change to match the diff --git a/docs/tutorials/akamai-edgedns.md b/docs/tutorials/akamai-edgedns.md index 4c8893423..e97c58b69 100644 --- a/docs/tutorials/akamai-edgedns.md +++ b/docs/tutorials/akamai-edgedns.md @@ -57,7 +57,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # or ingress or both - --provider=akamai @@ -143,7 +143,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # or ingress or both - --provider=akamai diff --git a/docs/tutorials/alibabacloud.md b/docs/tutorials/alibabacloud.md index 379e13b4c..de67a7f0c 100644 --- a/docs/tutorials/alibabacloud.md +++ b/docs/tutorials/alibabacloud.md @@ -113,7 +113,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -187,7 +187,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/aws-sd.md b/docs/tutorials/aws-sd.md index c540fc7da..71b33b3d4 100644 --- a/docs/tutorials/aws-sd.md +++ b/docs/tutorials/aws-sd.md @@ -81,7 +81,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 env: - name: AWS_REGION value: us-east-1 # put your CloudMap NameSpace region @@ -148,7 +148,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 env: - name: AWS_REGION value: us-east-1 # put your CloudMap NameSpace region diff --git a/docs/tutorials/aws.md b/docs/tutorials/aws.md index be05cad6e..05085cf42 100644 --- a/docs/tutorials/aws.md +++ b/docs/tutorials/aws.md @@ -414,7 +414,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -509,7 +509,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -962,7 +962,7 @@ A simple way to implement randomised startup is with an init container: spec: initContainers: - name: init-jitter - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 command: - /bin/sh - -c diff --git a/docs/tutorials/azure-private-dns.md b/docs/tutorials/azure-private-dns.md index 218b11dff..c9b3b3a9b 100644 --- a/docs/tutorials/azure-private-dns.md +++ b/docs/tutorials/azure-private-dns.md @@ -130,7 +130,7 @@ spec: spec: containers: - name: externaldns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -201,7 +201,7 @@ spec: serviceAccountName: externaldns containers: - name: externaldns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -272,7 +272,7 @@ spec: serviceAccountName: externaldns containers: - name: externaldns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/azure.md b/docs/tutorials/azure.md index 7d7e1a74a..89eb0c9aa 100644 --- a/docs/tutorials/azure.md +++ b/docs/tutorials/azure.md @@ -489,7 +489,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -557,7 +557,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -628,7 +628,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/bluecat.md b/docs/tutorials/bluecat.md index 5d386aab8..dc7134e46 100644 --- a/docs/tutorials/bluecat.md +++ b/docs/tutorials/bluecat.md @@ -46,7 +46,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --log-level=debug - --source=service @@ -136,7 +136,7 @@ spec: secretName: bluecatconfig containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 volumeMounts: - name: bluecatconfig mountPath: "/etc/external-dns/" diff --git a/docs/tutorials/civo.md b/docs/tutorials/civo.md index 7da6cbce0..df061fa51 100644 --- a/docs/tutorials/civo.md +++ b/docs/tutorials/civo.md @@ -40,7 +40,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -104,7 +104,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/cloudflare.md b/docs/tutorials/cloudflare.md index 869483e89..2e4f84e56 100644 --- a/docs/tutorials/cloudflare.md +++ b/docs/tutorials/cloudflare.md @@ -56,7 +56,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -125,7 +125,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/contour.md b/docs/tutorials/contour.md index ce27553b8..b6b582c96 100644 --- a/docs/tutorials/contour.md +++ b/docs/tutorials/contour.md @@ -24,7 +24,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -93,7 +93,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/coredns.md b/docs/tutorials/coredns.md index 3ef2caf31..be469f79c 100644 --- a/docs/tutorials/coredns.md +++ b/docs/tutorials/coredns.md @@ -108,7 +108,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --provider=coredns @@ -175,7 +175,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --provider=coredns diff --git a/docs/tutorials/designate.md b/docs/tutorials/designate.md index 7ed8b24b4..6f189205f 100644 --- a/docs/tutorials/designate.md +++ b/docs/tutorials/designate.md @@ -59,7 +59,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -136,7 +136,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/digitalocean.md b/docs/tutorials/digitalocean.md index a6874326f..3f15985a6 100644 --- a/docs/tutorials/digitalocean.md +++ b/docs/tutorials/digitalocean.md @@ -43,7 +43,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -107,7 +107,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/dnsimple.md b/docs/tutorials/dnsimple.md index 3bdce6838..31c296649 100644 --- a/docs/tutorials/dnsimple.md +++ b/docs/tutorials/dnsimple.md @@ -35,7 +35,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone you create in DNSimple. @@ -100,7 +100,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone you create in DNSimple. diff --git a/docs/tutorials/dyn.md b/docs/tutorials/dyn.md index 40f5c87ea..f90120b4f 100644 --- a/docs/tutorials/dyn.md +++ b/docs/tutorials/dyn.md @@ -43,7 +43,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --txt-prefix=_d diff --git a/docs/tutorials/exoscale.md b/docs/tutorials/exoscale.md index ba3e7b546..3f66448e4 100644 --- a/docs/tutorials/exoscale.md +++ b/docs/tutorials/exoscale.md @@ -40,7 +40,7 @@ spec: # serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress # or service or both - --provider=exoscale diff --git a/docs/tutorials/externalname.md b/docs/tutorials/externalname.md index 3604823ed..570440279 100644 --- a/docs/tutorials/externalname.md +++ b/docs/tutorials/externalname.md @@ -27,7 +27,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --log-level=debug - --source=service diff --git a/docs/tutorials/gandi.md b/docs/tutorials/gandi.md index a51ad0abd..449a5253a 100644 --- a/docs/tutorials/gandi.md +++ b/docs/tutorials/gandi.md @@ -39,7 +39,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -103,7 +103,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/gateway-api.md b/docs/tutorials/gateway-api.md index df3af4ff0..02f630987 100644 --- a/docs/tutorials/gateway-api.md +++ b/docs/tutorials/gateway-api.md @@ -72,7 +72,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: # Add desired Gateway API Route sources. - --source=gateway-httproute diff --git a/docs/tutorials/gke.md b/docs/tutorials/gke.md index e0308f9e7..81cde0cb9 100644 --- a/docs/tutorials/gke.md +++ b/docs/tutorials/gke.md @@ -319,7 +319,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/gloo-proxy.md b/docs/tutorials/gloo-proxy.md index 52b1f830c..c762c4991 100644 --- a/docs/tutorials/gloo-proxy.md +++ b/docs/tutorials/gloo-proxy.md @@ -22,7 +22,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=gloo-proxy - --gloo-namespace=custom-gloo-system # gloo system namespace. Specify multiple times for multiple namespaces. Omit to use the default (gloo-system) @@ -90,7 +90,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=gloo-proxy - --gloo-namespace=custom-gloo-system # gloo system namespace. Specify multiple times for multiple namespaces. Omit to use the default (gloo-system) diff --git a/docs/tutorials/godaddy.md b/docs/tutorials/godaddy.md index 0dddfdf81..65274e06d 100644 --- a/docs/tutorials/godaddy.md +++ b/docs/tutorials/godaddy.md @@ -44,7 +44,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -115,7 +115,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/hostport.md b/docs/tutorials/hostport.md index 904fe3667..0e7bea6bf 100644 --- a/docs/tutorials/hostport.md +++ b/docs/tutorials/hostport.md @@ -31,7 +31,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --log-level=debug - --source=service @@ -96,7 +96,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --log-level=debug - --source=service diff --git a/docs/tutorials/ibmcloud.md b/docs/tutorials/ibmcloud.md index b6a164d0f..ad724c0cb 100644 --- a/docs/tutorials/ibmcloud.md +++ b/docs/tutorials/ibmcloud.md @@ -69,7 +69,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -142,7 +142,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/infoblox.md b/docs/tutorials/infoblox.md index 143067d38..bdcb5a8a5 100644 --- a/docs/tutorials/infoblox.md +++ b/docs/tutorials/infoblox.md @@ -69,7 +69,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --domain-filter=example.com # (optional) limit to only example.com domains. @@ -150,7 +150,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --domain-filter=example.com # (optional) limit to only example.com domains. diff --git a/docs/tutorials/istio.md b/docs/tutorials/istio.md index ed1945b5d..e39717a4d 100644 --- a/docs/tutorials/istio.md +++ b/docs/tutorials/istio.md @@ -28,7 +28,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress @@ -98,7 +98,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/kong.md b/docs/tutorials/kong.md index 1c5bd6db3..602381465 100644 --- a/docs/tutorials/kong.md +++ b/docs/tutorials/kong.md @@ -22,7 +22,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=kong-tcpingress - --provider=aws @@ -86,7 +86,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=kong-tcpingress - --provider=aws diff --git a/docs/tutorials/linode.md b/docs/tutorials/linode.md index 101a1be3f..6651b1bcc 100644 --- a/docs/tutorials/linode.md +++ b/docs/tutorials/linode.md @@ -41,7 +41,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -105,7 +105,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/nginx-ingress.md b/docs/tutorials/nginx-ingress.md index fb663d554..735d8496e 100644 --- a/docs/tutorials/nginx-ingress.md +++ b/docs/tutorials/nginx-ingress.md @@ -273,7 +273,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --domain-filter=external-dns-test.gcp.zalan.do @@ -568,7 +568,7 @@ spec: - --google-project=zalando-external-dns-test - --registry=txt - --txt-owner-id=my-identifier - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 name: external-dns securityContext: fsGroup: 65534 diff --git a/docs/tutorials/nodes.md b/docs/tutorials/nodes.md index 09507180e..67029d018 100644 --- a/docs/tutorials/nodes.md +++ b/docs/tutorials/nodes.md @@ -29,7 +29,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=node # will use nodes as source - --provider=aws @@ -100,7 +100,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=node # will use nodes as source - --provider=aws diff --git a/docs/tutorials/ns1.md b/docs/tutorials/ns1.md index faccd6b1c..f7b5de37a 100644 --- a/docs/tutorials/ns1.md +++ b/docs/tutorials/ns1.md @@ -61,7 +61,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -125,7 +125,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/openshift.md b/docs/tutorials/openshift.md index b8297ee4f..38b26f835 100644 --- a/docs/tutorials/openshift.md +++ b/docs/tutorials/openshift.md @@ -66,7 +66,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=openshift-route - --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones @@ -133,7 +133,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=openshift-route - --domain-filter=external-dns-test.my-org.com # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones diff --git a/docs/tutorials/oracle.md b/docs/tutorials/oracle.md index 495a9e67c..d9fa15fbd 100644 --- a/docs/tutorials/oracle.md +++ b/docs/tutorials/oracle.md @@ -170,7 +170,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/ovh.md b/docs/tutorials/ovh.md index fbf7ee503..6a93134f0 100644 --- a/docs/tutorials/ovh.md +++ b/docs/tutorials/ovh.md @@ -91,7 +91,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -165,7 +165,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/pdns.md b/docs/tutorials/pdns.md index 28d8bbe92..318ab0519 100644 --- a/docs/tutorials/pdns.md +++ b/docs/tutorials/pdns.md @@ -42,7 +42,7 @@ spec: # serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # or ingress or both - --provider=pdns diff --git a/docs/tutorials/pihole.md b/docs/tutorials/pihole.md index 4c9e72e1d..39ab5b5c3 100644 --- a/docs/tutorials/pihole.md +++ b/docs/tutorials/pihole.md @@ -81,7 +81,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 # If authentication is disabled and/or you didn't create # a secret, you can remove this block. envFrom: diff --git a/docs/tutorials/plural.md b/docs/tutorials/plural.md index 98aaf2079..7c7c21552 100644 --- a/docs/tutorials/plural.md +++ b/docs/tutorials/plural.md @@ -35,7 +35,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -105,7 +105,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/public-private-route53.md b/docs/tutorials/public-private-route53.md index 970ad00b5..afb29faf4 100644 --- a/docs/tutorials/public-private-route53.md +++ b/docs/tutorials/public-private-route53.md @@ -243,7 +243,7 @@ spec: - --txt-owner-id=external-dns - --ingress-class=external-ingress - --aws-zone-type=public - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 name: external-dns-public ``` @@ -281,7 +281,7 @@ spec: - --txt-owner-id=dev.k8s.nexus - --ingress-class=internal-ingress - --aws-zone-type=private - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 name: external-dns-private ``` diff --git a/docs/tutorials/rcodezero.md b/docs/tutorials/rcodezero.md index 72ee1b32f..ec81c0998 100644 --- a/docs/tutorials/rcodezero.md +++ b/docs/tutorials/rcodezero.md @@ -53,7 +53,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -120,7 +120,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/rdns.md b/docs/tutorials/rdns.md index 62653a508..5e7f21af8 100644 --- a/docs/tutorials/rdns.md +++ b/docs/tutorials/rdns.md @@ -54,7 +54,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --provider=rdns @@ -123,7 +123,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=ingress - --provider=rdns diff --git a/docs/tutorials/rfc2136.md b/docs/tutorials/rfc2136.md index 447a4be11..ca9ff4a61 100644 --- a/docs/tutorials/rfc2136.md +++ b/docs/tutorials/rfc2136.md @@ -218,7 +218,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --registry=txt - --txt-prefix=external-dns- @@ -261,7 +261,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --registry=txt - --txt-prefix=external-dns- diff --git a/docs/tutorials/scaleway.md b/docs/tutorials/scaleway.md index 47e2bdb20..c0828ce57 100644 --- a/docs/tutorials/scaleway.md +++ b/docs/tutorials/scaleway.md @@ -60,7 +60,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -140,7 +140,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. diff --git a/docs/tutorials/security-context.md b/docs/tutorials/security-context.md index 107033778..d4ce96674 100644 --- a/docs/tutorials/security-context.md +++ b/docs/tutorials/security-context.md @@ -20,7 +20,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - ... # your arguments here securityContext: diff --git a/docs/tutorials/tencentcloud.md b/docs/tutorials/tencentcloud.md index ea567f382..d626644d2 100644 --- a/docs/tutorials/tencentcloud.md +++ b/docs/tutorials/tencentcloud.md @@ -129,7 +129,7 @@ spec: - --policy=sync # set `upsert-only` would prevent ExternalDNS from deleting any records - --tencent-cloud-zone-type=private # only look at private hosted zones. set `public` to use the public dns service. - --tencent-cloud-config-file=/etc/kubernetes/tencent-cloud.json - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 imagePullPolicy: Always name: external-dns resources: {} diff --git a/docs/tutorials/traefik-proxy.md b/docs/tutorials/traefik-proxy.md index 2223a53c0..ed00ae4f9 100644 --- a/docs/tutorials/traefik-proxy.md +++ b/docs/tutorials/traefik-proxy.md @@ -24,7 +24,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.3 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=traefik-proxy - --provider=aws @@ -87,7 +87,7 @@ spec: containers: - name: external-dns # update this to the desired external-dns version - image: registry.k8s.io/external-dns/external-dns:v0.13.3 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=traefik-proxy - --provider=aws diff --git a/docs/tutorials/transip.md b/docs/tutorials/transip.md index d2a7aa3f6..4987bd09d 100644 --- a/docs/tutorials/transip.md +++ b/docs/tutorials/transip.md @@ -36,7 +36,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains @@ -107,7 +107,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains diff --git a/docs/tutorials/ultradns.md b/docs/tutorials/ultradns.md index 50d98cf6c..ed27b8457 100644 --- a/docs/tutorials/ultradns.md +++ b/docs/tutorials/ultradns.md @@ -44,7 +44,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress # ingress is also possible @@ -116,7 +116,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service - --source=ingress diff --git a/docs/tutorials/vinyldns.md b/docs/tutorials/vinyldns.md index 1005b63c3..e1c45c7ed 100644 --- a/docs/tutorials/vinyldns.md +++ b/docs/tutorials/vinyldns.md @@ -66,7 +66,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --provider=vinyldns - --source=service @@ -137,7 +137,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --provider=vinyldns - --source=service diff --git a/docs/tutorials/vultr.md b/docs/tutorials/vultr.md index 0c491c0f6..de8fb33c7 100644 --- a/docs/tutorials/vultr.md +++ b/docs/tutorials/vultr.md @@ -42,7 +42,7 @@ spec: spec: containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. @@ -106,7 +106,7 @@ spec: serviceAccountName: external-dns containers: - name: external-dns - image: registry.k8s.io/external-dns/external-dns:v0.13.5 + image: registry.k8s.io/external-dns/external-dns:v0.14.0 args: - --source=service # ingress is also possible - --domain-filter=example.com # (optional) limit to only example.com domains; change to match the zone created above. From 6a3e97083cbdbede258011b9c386bdb24cbd5acd Mon Sep 17 00:00:00 2001 From: Dieter Bocklandt Date: Tue, 14 Nov 2023 17:12:56 +0100 Subject: [PATCH 08/10] fix(google): ensure trailing dot for SRV records --- provider/google/google.go | 6 ++++++ source/crd_test.go | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/provider/google/google.go b/provider/google/google.go index cc01a9642..b591fa32e 100644 --- a/provider/google/google.go +++ b/provider/google/google.go @@ -467,6 +467,12 @@ func newRecord(ep *endpoint.Endpoint) *dns.ResourceRecordSet { } } + if ep.RecordType == endpoint.RecordTypeSRV { + for i, srvRecord := range ep.Targets { + targets[i] = provider.EnsureTrailingDot(srvRecord) + } + } + // no annotation results in a Ttl of 0, default to 300 for backwards-compatibility var ttl int64 = googleRecordTTL if ep.RecordTTL.IsConfigured() { diff --git a/source/crd_test.go b/source/crd_test.go index 4f26aacfa..736e25f1a 100644 --- a/source/crd_test.go +++ b/source/crd_test.go @@ -383,6 +383,27 @@ func testCRDSourceEndpoints(t *testing.T) { expectEndpoints: true, expectError: false, }, + { + title: "Create SRV record", + registeredAPIVersion: "test.k8s.io/v1alpha1", + apiVersion: "test.k8s.io/v1alpha1", + registeredKind: "DNSEndpoint", + kind: "DNSEndpoint", + namespace: "foo", + registeredNamespace: "foo", + labels: map[string]string{"test": "that"}, + labelFilter: "test=that", + endpoints: []*endpoint.Endpoint{ + { + DNSName: "_svc._tcp.example.org", + Targets: endpoint.Targets{"0 0 80 abc.example.org", "0 0 80 def.example.org"}, + RecordType: endpoint.RecordTypeSRV, + RecordTTL: 180, + }, + }, + expectEndpoints: true, + expectError: false, + }, } { ti := ti t.Run(ti.title, func(t *testing.T) { From dbaca73de26bcad0e42397ce7b0802fc6d5d348e Mon Sep 17 00:00:00 2001 From: Anders Swanson Date: Tue, 14 Nov 2023 12:59:39 -0800 Subject: [PATCH 09/10] oracle provider: dns zone cache Signed-off-by: Anders Swanson --- docs/tutorials/oracle.md | 3 ++ main.go | 2 +- pkg/apis/externaldns/types.go | 3 ++ pkg/apis/externaldns/types_test.go | 4 ++ provider/oci/cache.go | 44 ++++++++++++++++++ provider/oci/cache_test.go | 75 ++++++++++++++++++++++++++++++ provider/oci/oci.go | 17 +++++-- provider/oci/oci_test.go | 6 ++- 8 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 provider/oci/cache.go create mode 100644 provider/oci/cache_test.go diff --git a/docs/tutorials/oracle.md b/docs/tutorials/oracle.md index d9fa15fbd..994f29638 100644 --- a/docs/tutorials/oracle.md +++ b/docs/tutorials/oracle.md @@ -180,6 +180,9 @@ spec: # Specifies the OCI DNS Zone scope, defaults to GLOBAL. # May be GLOBAL, PRIVATE, or an empty value to specify both GLOBAL and PRIVATE OCI DNS Zones # - --oci-zone-scope=GLOBAL + # Specifies the zone cache duration, defaults to 0s. If set to 0s, the zone cache is disabled. + # Use of zone caching is recommended to reduce the amount of requests sent to OCI DNS. + # - --oci-zones-cache-duration=0s volumeMounts: - name: config mountPath: /etc/kubernetes/ diff --git a/main.go b/main.go index b86fea3f7..d0756f84d 100644 --- a/main.go +++ b/main.go @@ -360,7 +360,7 @@ func main() { } else { config, err = oci.LoadOCIConfig(cfg.OCIConfigFile) } - + config.ZoneCacheDuration = cfg.OCIZoneCacheDuration if err == nil { p, err = oci.NewOCIProvider(*config, domainFilter, zoneIDFilter, cfg.OCIZoneScope, cfg.DryRun) } diff --git a/pkg/apis/externaldns/types.go b/pkg/apis/externaldns/types.go index 5d65704c7..0ae71197d 100644 --- a/pkg/apis/externaldns/types.go +++ b/pkg/apis/externaldns/types.go @@ -136,6 +136,7 @@ type Config struct { OCICompartmentOCID string OCIAuthInstancePrincipal bool OCIZoneScope string + OCIZoneCacheDuration time.Duration InMemoryZones []string OVHEndpoint string OVHApiRateLimit int @@ -293,6 +294,7 @@ var defaultConfig = &Config{ InfobloxCacheDuration: 0, OCIConfigFile: "/etc/kubernetes/oci.yaml", OCIZoneScope: "GLOBAL", + OCIZoneCacheDuration: 0 * time.Second, InMemoryZones: []string{}, OVHEndpoint: "ovh-eu", OVHApiRateLimit: 20, @@ -527,6 +529,7 @@ func (cfg *Config) ParseFlags(args []string) error { app.Flag("oci-compartment-ocid", "When using the OCI provider, specify the OCID of the OCI compartment containing all managed zones and records. Required when using OCI IAM instance principal authentication.").StringVar(&cfg.OCICompartmentOCID) app.Flag("oci-zone-scope", "When using OCI provider, filter for zones with this scope (optional, options: GLOBAL, PRIVATE). Defaults to GLOBAL, setting to empty value will target both.").Default(defaultConfig.OCIZoneScope).EnumVar(&cfg.OCIZoneScope, "", "GLOBAL", "PRIVATE") app.Flag("oci-auth-instance-principal", "When using the OCI provider, specify whether OCI IAM instance principal authentication should be used (instead of key-based auth via the OCI config file).").Default(strconv.FormatBool(defaultConfig.OCIAuthInstancePrincipal)).BoolVar(&cfg.OCIAuthInstancePrincipal) + app.Flag("oci-zones-cache-duration", "When using the OCI provider, set the zones list cache TTL (0s to disable).").Default(defaultConfig.OCIZoneCacheDuration.String()).DurationVar(&cfg.OCIZoneCacheDuration) app.Flag("rcodezero-txt-encrypt", "When using the Rcodezero provider with txt registry option, set if TXT rrs are encrypted (default: false)").Default(strconv.FormatBool(defaultConfig.RcodezeroTXTEncrypt)).BoolVar(&cfg.RcodezeroTXTEncrypt) app.Flag("inmemory-zone", "Provide a list of pre-configured zones for the inmemory provider; specify multiple times for multiple zones (optional)").Default("").StringsVar(&cfg.InMemoryZones) app.Flag("ovh-endpoint", "When using the OVH provider, specify the endpoint (default: ovh-eu)").Default(defaultConfig.OVHEndpoint).StringVar(&cfg.OVHEndpoint) diff --git a/pkg/apis/externaldns/types_test.go b/pkg/apis/externaldns/types_test.go index b48072f00..a8093fe1e 100644 --- a/pkg/apis/externaldns/types_test.go +++ b/pkg/apis/externaldns/types_test.go @@ -95,6 +95,7 @@ var ( InfobloxMaxResults: 0, OCIConfigFile: "/etc/kubernetes/oci.yaml", OCIZoneScope: "GLOBAL", + OCIZoneCacheDuration: 0 * time.Second, InMemoryZones: []string{""}, OVHEndpoint: "ovh-eu", OVHApiRateLimit: 20, @@ -205,6 +206,7 @@ var ( InfobloxMaxResults: 2000, OCIConfigFile: "oci.yaml", OCIZoneScope: "PRIVATE", + OCIZoneCacheDuration: 30 * time.Second, InMemoryZones: []string{"example.org", "company.com"}, OVHEndpoint: "ovh-ca", OVHApiRateLimit: 42, @@ -328,6 +330,7 @@ func TestParseFlags(t *testing.T) { "--pdns-skip-tls-verify", "--oci-config-file=oci.yaml", "--oci-zone-scope=PRIVATE", + "--oci-zones-cache-duration=30s", "--tls-ca=/path/to/ca.crt", "--tls-client-cert=/path/to/cert.pem", "--tls-client-cert-key=/path/to/key.pem", @@ -449,6 +452,7 @@ func TestParseFlags(t *testing.T) { "EXTERNAL_DNS_INFOBLOX_MAX_RESULTS": "2000", "EXTERNAL_DNS_OCI_CONFIG_FILE": "oci.yaml", "EXTERNAL_DNS_OCI_ZONE_SCOPE": "PRIVATE", + "EXTERNAL_DNS_OCI_ZONES_CACHE_DURATION": "30s", "EXTERNAL_DNS_INMEMORY_ZONE": "example.org\ncompany.com", "EXTERNAL_DNS_OVH_ENDPOINT": "ovh-ca", "EXTERNAL_DNS_OVH_API_RATE_LIMIT": "42", diff --git a/provider/oci/cache.go b/provider/oci/cache.go new file mode 100644 index 000000000..1e099355c --- /dev/null +++ b/provider/oci/cache.go @@ -0,0 +1,44 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package oci + +import ( + "time" + + "github.com/oracle/oci-go-sdk/v65/dns" +) + +type zoneCache struct { + age time.Time + duration time.Duration + zones map[string]dns.ZoneSummary +} + +func (z *zoneCache) Reset(zones map[string]dns.ZoneSummary) { + if z.duration > time.Duration(0) { + z.age = time.Now() + z.zones = zones + } +} + +func (z *zoneCache) Get() map[string]dns.ZoneSummary { + return z.zones +} + +func (z *zoneCache) Expired() bool { + return len(z.zones) < 1 || time.Since(z.age) > z.duration +} diff --git a/provider/oci/cache_test.go b/provider/oci/cache_test.go new file mode 100644 index 000000000..a485e200a --- /dev/null +++ b/provider/oci/cache_test.go @@ -0,0 +1,75 @@ +/* +Copyright 2023 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package oci + +import ( + "github.com/oracle/oci-go-sdk/v65/dns" + "github.com/stretchr/testify/assert" + "testing" + "time" +) + +func TestZoneCache(t *testing.T) { + now := time.Now() + var testCases = map[string]struct { + z *zoneCache + expired bool + }{ + "inactive-zone-cache": { + &zoneCache{ + duration: 0 * time.Second, + }, + true, + }, + "empty-active-zone-cache": { + &zoneCache{ + duration: 30 * time.Second, + }, + true, + }, + "expired-zone-cache": { + &zoneCache{ + age: now.Add(300 * time.Second), + duration: 30 * time.Second, + }, + true, + }, + "active-zone-cache": { + &zoneCache{ + zones: map[string]dns.ZoneSummary{ + zoneIdBaz: testPrivateZoneSummaryBaz, + }, + duration: 30 * time.Second, + }, + true, + }, + } + + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + assert.Equal(t, testCase.expired, testCase.z.Expired()) + var resetZoneLength = 1 + if testCase.z.duration == 0 { + resetZoneLength = 0 + } + testCase.z.Reset(map[string]dns.ZoneSummary{ + zoneIdQux: testPrivateZoneSummaryQux, + }) + assert.Len(t, testCase.z.Get(), resetZoneLength) + }) + } +} diff --git a/provider/oci/oci.go b/provider/oci/oci.go index 97b1ea31f..c811c14d3 100644 --- a/provider/oci/oci.go +++ b/provider/oci/oci.go @@ -20,6 +20,7 @@ import ( "context" "os" "strings" + "time" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/common/auth" @@ -49,8 +50,9 @@ type OCIAuthConfig struct { // OCIConfig holds the configuration for the OCI Provider. type OCIConfig struct { - Auth OCIAuthConfig `yaml:"auth"` - CompartmentID string `yaml:"compartment"` + Auth OCIAuthConfig `yaml:"auth"` + CompartmentID string `yaml:"compartment"` + ZoneCacheDuration time.Duration } // OCIProvider is an implementation of Provider for Oracle Cloud Infrastructure @@ -63,6 +65,7 @@ type OCIProvider struct { domainFilter endpoint.DomainFilter zoneIDFilter provider.ZoneIDFilter zoneScope string + zoneCache *zoneCache dryRun bool } @@ -135,11 +138,18 @@ func NewOCIProvider(cfg OCIConfig, domainFilter endpoint.DomainFilter, zoneIDFil domainFilter: domainFilter, zoneIDFilter: zoneIDFilter, zoneScope: zoneScope, - dryRun: dryRun, + zoneCache: &zoneCache{ + duration: cfg.ZoneCacheDuration, + }, + dryRun: dryRun, }, nil } func (p *OCIProvider) zones(ctx context.Context) (map[string]dns.ZoneSummary, error) { + if !p.zoneCache.Expired() { + log.Debug("Using cached zones list") + return p.zoneCache.zones, nil + } zones := make(map[string]dns.ZoneSummary) scopes := []dns.GetZoneScopeEnum{dns.GetZoneScopeEnum(p.zoneScope)} // If zone scope is empty, list all zones types. @@ -155,6 +165,7 @@ func (p *OCIProvider) zones(ctx context.Context) (map[string]dns.ZoneSummary, er if len(zones) == 0 { log.Warnf("No zones in compartment %q match domain filters %v", p.cfg.CompartmentID, p.domainFilter) } + p.zoneCache.Reset(zones) return zones, nil } diff --git a/provider/oci/oci_test.go b/provider/oci/oci_test.go index 2f9bf5fd6..82a82169d 100644 --- a/provider/oci/oci_test.go +++ b/provider/oci/oci_test.go @@ -21,6 +21,7 @@ import ( "sort" "strings" "testing" + "time" "github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/dns" @@ -137,7 +138,10 @@ func newOCIProvider(client ociDNSClient, domainFilter endpoint.DomainFilter, zon domainFilter: domainFilter, zoneIDFilter: zoneIDFilter, zoneScope: zoneScope, - dryRun: dryRun, + zoneCache: &zoneCache{ + duration: 0 * time.Second, + }, + dryRun: dryRun, } } From 175b20b095f2d8337ba2d65875829a49ce3b1c78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 04:00:37 +0000 Subject: [PATCH 10/10] build(deps): bump the dev-dependencies group with 1 update Bumps the dev-dependencies group with 1 update: [actions/github-script](https://github.com/actions/github-script). - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/d7906e4ad0b1822421a7e6a35d5ca353c962f410...e69ef5462fd455e02edcaf4dd7708eda96b9eda0) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/gh-workflow-approve.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-workflow-approve.yaml b/.github/workflows/gh-workflow-approve.yaml index 71b51b0ae..69e069cf0 100644 --- a/.github/workflows/gh-workflow-approve.yaml +++ b/.github/workflows/gh-workflow-approve.yaml @@ -17,7 +17,7 @@ jobs: actions: write steps: - name: Update PR - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + uses: actions/github-script@e69ef5462fd455e02edcaf4dd7708eda96b9eda0 # v7.0.0 continue-on-error: true with: github-token: ${{ secrets.GITHUB_TOKEN }}