Commit Graph

333 Commits

Author SHA1 Message Date
Charles Xu
1d232c4b86 feat: resolve LB-type Service hostname to create A/AAAA instead of CNAME 2023-04-18 21:10:56 -07:00
Kubernetes Prow Robot
e6ec8ea329
Merge pull request #2220 from ericrrath/crd-source-event-handler
CRD source: add event-handler support
2023-04-13 23:20:39 -07:00
John Gardiner Myers
781ee3d71f Address review comments 2023-04-12 22:46:39 -07:00
John Gardiner Myers
258986c7ce Add test case for extracting IPv6 from Ingress status 2023-03-30 17:49:31 -07:00
John Gardiner Myers
6b20ba301c Remove unnecessary unit test changes 2023-03-30 17:49:31 -07:00
John Gardiner Myers
de1db3f03d Unit test fixes 2023-03-30 17:49:31 -07:00
Skyler Mäntysaari
6f42a8a2da Initial IPv6 support 2023-03-30 17:49:28 -07:00
John Gardiner Myers
06227c1fbf Make unit tests more strict about record type 2023-03-30 17:47:59 -07:00
Mikael Johansson
9a76be0202 Add F5 VirtualServer source 2023-03-14 10:23:56 +01:00
Eric R. Rath
929e618935 --events controls CRD informer creation
mgruener suggested that the --events flag could be wired to control whether or
not the CRD source created and started its informer.  This commit makes that
change; good idea!
2023-02-27 12:34:16 -08:00
Andy Bursavich
13d978caeb gateway-api: upgrade from v0.5.1 to v0.6.0 and add GRPCRoute support 2023-01-04 08:18:35 -08:00
Andy Bursavich
ac6ce47b99 Bump k8s.io/{api,apimachinery,clientgo} from v0.25.2 to v0.26.0 2023-01-04 08:15:59 -08:00
Andy Bursavich
ad7e1509e0 gateway-api: patch route informer results with TypeMeta 2022-12-28 17:39:15 -08:00
Raffaele Di Fazio
31e6bb8578
CI linting fixes (#3205)
* ci linting fixes

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* remove staticcheck

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* disable naming rule

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* disable stylecheck too

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* linter errors fixes

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* re-add staticcheck

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fixes various linting issues

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix imports

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix tlsconfig

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* fix alibabacloud

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* ioutil fixes

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* remove all references to ioutil

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

* ignore linting for azure deprecated sdk

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>

Signed-off-by: Raffaele Di Fazio <difazio.raffaele@gmail.com>
2022-12-02 10:57:53 -08:00
ricoberger
d56ad7f683 Fix deletion of DNS Records for VirtualServices on error 2022-11-10 18:12:42 +01:00
Mikael Johansson
b9996e2627 Fix minor typo 2022-10-22 13:16:06 +02:00
Andy Bursavich
b0dc1739aa gateway-api: switch to v1beta1 apis where available 2022-09-21 09:01:30 -07:00
Andy Bursavich
a7a56b9380 gateway-api: upgrade from v0.4.3 to v0.5.0 2022-09-21 09:01:30 -07:00
Andy Bursavich
74ffff6c26 gofumpt 2022-09-20 20:48:57 -07:00
Ole Markus With
a1a9091cdf Ignore ambassador-hosts with invalid annotations
If e.g the ambassador service annotation points to an nonexisting service, external-dns will not update any DNS records. This PR makes external-dns ignore the host and carry on instead.
2022-09-07 19:38:36 +02:00
Ole Markus With
594519a09b Add test for ambassador source failing to fetch ambassador service 2022-09-07 19:38:25 +02:00
Kubernetes Prow Robot
e2b86a1146
Merge pull request #2693 from tobikris/add-target-net-filter
add target filters based on network
2022-08-02 01:38:15 -07:00
Kubernetes Prow Robot
de1db79bad
Merge pull request #2707 from hughhuangzh/add_ibmcloud_provider
Add IBM Cloud provider
2022-05-26 01:39:23 -07:00
Kubernetes Prow Robot
66e0d8c7fe
Merge pull request #2292 from abursavich/gateway-redo
Add Support for Gateway API Route Sources
2022-05-25 01:20:44 -07:00
Kubernetes Prow Robot
379fe6f554
Merge pull request #2215 from abursavich/istio-informer
Istio: Use existing VirtualService informer
2022-05-12 05:33:14 -07:00
hzhihui
2270904b9d
Merge branch 'master' into add_ibmcloud_provider 2022-05-09 19:24:03 +08:00
Alfred Krohmer
ea45b03972 Headless service: allow to specify target as NodeExternalIP or by annotation
If external-dns.alpha.kubernetes.io/target annotation is present on a
pod, it's value will be used as the target for the headless service.

If annotation external-dns.alpha.kubernetes.io/access=public is present,
NodeExternalIP of the node running the pod is used as the target for the
headless service.
2022-05-05 19:44:32 +02:00
hzhihui
090270e89f
Merge branch 'master' into add_ibmcloud_provider 2022-04-28 09:11:15 +08:00
Kubernetes Prow Robot
042654c4cf
Merge pull request #2538 from mcwarman/istio-gateway-logging
istio-gateway: Add debug logging when endpoints missing
2022-04-27 01:00:11 -07:00
hzhihui
4703c11741 Add IBM Cloud provider 2022-04-14 11:53:16 +08:00
Tobias Krischer
692f2bbc23
add target filters based on network 2022-04-08 19:29:58 +02:00
Andy Bursavich
4371589a14 gateway: enforce listener matching 2022-02-24 21:33:53 -08:00
Andy Bursavich
71e45ce1d3 gateway-udproute: add source 2022-02-24 21:30:10 -08:00
Andy Bursavich
52e3fd61db gateway-tcproute: add source 2022-02-24 21:30:10 -08:00
Andy Bursavich
32ca4e6de8 gateway-tlsroute: add source 2022-02-24 21:30:10 -08:00
Andy Bursavich
3a1d86be20 gateway-httproute: add source 2022-02-24 21:30:10 -08:00
Andy Bursavich
48203e64c9 source: add gateway client 2022-02-24 21:30:10 -08:00
Andrey Lebedev
a53498735b openshift route source: better use of route status 2022-02-21 13:26:50 +01:00
Eric R. Rath
56a8d60fff Review feedback
njuettner suggested using a var instead of boolean literals for the
startInformer arg to NewCRDSource; good idea.
2022-02-04 15:36:29 -08:00
Eric R. Rath
585d752ca4 Don't run CRD informer during tests
This change disables the CRD source's informer during tests.  I made the mistake
of not running `make test` before the previous commit, and thus didn't realize
that leaving the informer enabled during the tests introduced a race condition:

	WARNING: DATA RACE
	Write at 0x00c0005aa130 by goroutine 59:
	  k8s.io/client-go/rest/fake.(*RESTClient).do()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:113 +0x69
	  k8s.io/client-go/rest/fake.(*RESTClient).do-fm()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:109 +0x64
	  k8s.io/client-go/rest/fake.roundTripperFunc.RoundTrip()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:43 +0x3d
	  net/http.send()
		  /usr/local/go/src/net/http/client.go:251 +0x6da
	  net/http.(*Client).send()
		  /usr/local/go/src/net/http/client.go:175 +0x1d5
	  net/http.(*Client).do()
		  /usr/local/go/src/net/http/client.go:717 +0x2cb
	  net/http.(*Client).Do()
		  /usr/local/go/src/net/http/client.go:585 +0x68b
	  k8s.io/client-go/rest.(*Request).request()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/request.go:855 +0x209
	  k8s.io/client-go/rest.(*Request).Do()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/request.go:928 +0xf0
	  sigs.k8s.io/external-dns/source.(*crdSource).List()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd.go:250 +0x28c
	  sigs.k8s.io/external-dns/source.NewCRDSource.func1()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd.go:125 +0x10a
	  k8s.io/client-go/tools/cache.(*ListWatch).List()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/listwatch.go:106 +0x94
	  k8s.io/client-go/tools/cache.(*Reflector).ListAndWatch.func1.1.2()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:233 +0xf4
	  k8s.io/client-go/tools/pager.SimplePageFunc.func1()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/pager/pager.go:40 +0x94
	  k8s.io/client-go/tools/pager.(*ListPager).List()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/pager/pager.go:91 +0x1f4
	  k8s.io/client-go/tools/cache.(*Reflector).ListAndWatch.func1.1()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:258 +0x2b7

	Previous write at 0x00c0005aa130 by goroutine 37:
	  k8s.io/client-go/rest/fake.(*RESTClient).do()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:113 +0x69
	  k8s.io/client-go/rest/fake.(*RESTClient).do-fm()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:109 +0x64
	  k8s.io/client-go/rest/fake.roundTripperFunc.RoundTrip()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/fake/fake.go:43 +0x3d
	  net/http.send()
		  /usr/local/go/src/net/http/client.go:251 +0x6da
	  net/http.(*Client).send()
		  /usr/local/go/src/net/http/client.go:175 +0x1d5
	  net/http.(*Client).do()
		  /usr/local/go/src/net/http/client.go:717 +0x2cb
	  net/http.(*Client).Do()
		  /usr/local/go/src/net/http/client.go:585 +0x68b
	  k8s.io/client-go/rest.(*Request).request()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/request.go:855 +0x209
	  k8s.io/client-go/rest.(*Request).Do()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/rest/request.go:928 +0xf0
	  sigs.k8s.io/external-dns/source.(*crdSource).List()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd.go:250 +0x28c
	  sigs.k8s.io/external-dns/source.(*crdSource).Endpoints()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd.go:171 +0x13c4
	  sigs.k8s.io/external-dns/source.testCRDSourceEndpoints.func1()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd_test.go:388 +0x4f6
	  testing.tRunner()
		  /usr/local/go/src/testing/testing.go:1193 +0x202

	Goroutine 59 (running) created at:
	  k8s.io/client-go/tools/cache.(*Reflector).ListAndWatch.func1()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:224 +0x36f
	  k8s.io/client-go/tools/cache.(*Reflector).ListAndWatch()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:316 +0x1ab
	  k8s.io/client-go/tools/cache.(*Reflector).Run.func1()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:177 +0x4a
	  k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1()
		  /Users/erath/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:155 +0x75
	  k8s.io/apimachinery/pkg/util/wait.BackoffUntil()
		  /Users/erath/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:156 +0xba
	  k8s.io/client-go/tools/cache.(*Reflector).Run()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:176 +0xee
	  k8s.io/client-go/tools/cache.(*Reflector).Run-fm()
		  /Users/erath/go/pkg/mod/k8s.io/client-go@v0.18.8/tools/cache/reflector.go:174 +0x54
	  k8s.io/apimachinery/pkg/util/wait.(*Group).StartWithChannel.func1()
		  /Users/erath/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:56 +0x45
	  k8s.io/apimachinery/pkg/util/wait.(*Group).Start.func1()
		  /Users/erath/go/pkg/mod/k8s.io/apimachinery@v0.18.8/pkg/util/wait/wait.go:73 +0x6d

	Goroutine 37 (running) created at:
	  testing.(*T).Run()
		  /usr/local/go/src/testing/testing.go:1238 +0x5d7
	  sigs.k8s.io/external-dns/source.testCRDSourceEndpoints()
		  /Users/erath/go/src/github.com/ericrrath/external-dns/source/crd_test.go:376 +0x1fcf
	  testing.tRunner()
		  /usr/local/go/src/testing/testing.go:1193 +0x202

It looks like client-go's fake.RESTClient (used by crd_test.go) is known to
cause race conditions when used with informers:
<https://github.com/kubernetes/kubernetes/issues/95372>.  None of the CRD tests
_depend_ on the informer yet, so disabling the informer at least allows the
existing tests to pass without race conditions.  I'll look into further changes
that 1) test the new event-handler behavior, and 2) allow all tests to pass
without race conditions.
2022-02-04 15:32:03 -08:00
Eric R. Rath
5146dab6fa ran goimports on crd.go to fix linter warning 2022-02-04 15:27:36 -08:00
Eric R. Rath
d9bf8fb329 CRD source: add event-handler support
When the --events flag is passed at startup, Source.AddEventHandler() is called
on each configured source.  Most sources provide AddEventHandler()
implementations that invoke the reconciliation loop when the configured source
changes, but the CRD source had a no-op implementation.  I.e. when a custom
resource was created, updated, or deleted, external-dns remained unware, and the
reconciliation loop would not fire until the configured interval had passed.

This change adds an informer (on the CRD specified by --crd-source-apiversion
and --crd-source-kind=DNSEndpoint), and a Source.AddEventHandler()
implementation that calls Informer.AddEventHandler().  Now when a custom
resource is created, updated, or deleted, the reconciliation loop is invoked.
2022-02-04 15:27:36 -08:00
Matthew Warman
b79dc1e894 istio-gateway: Add debug logging when endpoints missing 2022-01-24 12:55:09 +00:00
Andrey Lebedev
4f41229820 Pass stop channel to informer factory instances 2022-01-22 21:31:29 +01:00
Michael Gruener
b8a08512e9 Add event handler for OpenShift Route source 2021-11-22 15:16:13 +01:00
Kubernetes Prow Robot
9cf3d4906c
Merge pull request #2400 from miheer/add-router-field-for-ocpRouteSource
Fix CNAME record when multiple router canonical name are defined in Route Status.
2021-11-19 05:50:52 -08:00
Kubernetes Prow Robot
39931b7cb0
Merge pull request #2259 from mper0003/issue-2245
service: fix merging of endpoints - same hostname different set-identifier
2021-11-03 04:32:58 -07:00
Miheer Salunke
ab8a62045e In OCP when you have multiple ingress controllers the route's status Ingress object get populated with multiple router canonical names. So in this case, the external dns tries to add multiple CNAME records for same host in the same hosted zone which is a violation of RFC 1912  and therefore is rejected by standards-compliant DNS services.
This feature adds a router field to the OCP Route Source so that a user can add an ingress controller name in flag --ocp-router-name which will be used to pick up the respective routerCanonicalHostname from Route's Status Ingress Object.

Signed-off-by: Miheer Salunke <miheer.salunke@gmail.com>
2021-11-03 12:52:57 +10:00
Arjun Naik
d91b7e6b8f Label filtering for Ingress, Service, Openshift Route sources
Currently the `--label-filter` flag can only be used to filter CRDs
which match the label selector passed through that flag. This change
extends the functionality to the Ingress, Service and Openshift Route
type objects. When the flag is not specified the default value is
`labels.Everything()` which is an empty string, the same as before.
Annotation based filter is inefficient because the filtering has to be
done in the controller instead of the API server like with label
filtering.
2021-10-14 11:06:55 +02:00
Andrew Stuart
0e27f41fa0
Update external-dns to use v1 ingress 2021-09-08 09:29:05 -07:00