fix(external-dns): stop enabling the service source on tenant instances (#5470)

## What this PR does

Every `ExternalDNS` application crash-loops about a minute after it
starts and never publishes a record. It always enables the `service`
source, which starts a Node informer, but the instance runs namespaced,
so its Role has no `nodes` rule and the informer never syncs (`failed to
sync *v1.Node: context deadline exceeded`).

Closes #4958

The single commit drops `service` from the hardcoded sources, as agreed
on the issue, so the default configuration uses only `ingress`. The
rendered Gateway API source list is preserved; its separate cluster-wide
informer permissions problem remains outside this fix. It also adds a
`test` target and a helm-unittest suite to the package that pins the
rendered sources in both cases. Both tests fail on current `main`.

Nobody loses records: tenants can't annotate the Services the platform
renders, so the `service` source published nothing. The kuberture guide
already pairs its annotated Services with the cluster-wide
`cozystack.external-dns` package, not this application.

### Screenshots

N/A, no UI changes.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(external-dns): ExternalDNS applications no longer crash-loop on "failed to sync *v1.Node". The tenant instance stops enabling the `service` source, which needs cluster-wide read on Nodes that its namespaced Role cannot grant, and publishes records from Ingresses in the default configuration.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Configuration**
* ExternalDNS monitors ingress resources by default. Service resources
are no longer included as a discovery source.
* When Gateway API support is enabled, ExternalDNS also monitors Gateway
API HTTP and TLS routes.
* **Tests**
* Added checks confirming the default discovery sources and the sources
used when Gateway API support is enabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aleksei Sviridkin authored and GitHub committed 2026-12-01 21:47:44 +03:00
commit a1e938767c
3 files changed
+26 -1

No files matched your search

+3
View File
@@ -5,3 +5,6 @@ include ../../../hack/package.mk
generate:
cozyvalues-gen -v values.yaml -s values.schema.json -r README.md
../../../hack/update-crd.sh
test:
helm unittest .
@@ -33,7 +33,6 @@ spec:
name: {{ .Values.provider | quote }}
sources:
- ingress
- service
{{- if .Values.gatewayAPI }}
- gateway-httproute
- gateway-tlsroute
@@ -0,0 +1,23 @@
suite: external-dns rendered sources
templates:
- templates/external-dns.yaml
set:
provider: inmemory
tests:
# The default source must not start a Node informer: the namespaced Role
# cannot grant access to nodes.
- it: enables only the ingress source by default
asserts:
- equal:
path: spec.values.external-dns.sources
value: [ingress]
- it: adds the Gateway API route sources when gatewayAPI is on
set:
gatewayAPI: true
asserts:
- equal:
path: spec.values.external-dns.sources
value: [ingress, gateway-httproute, gateway-tlsroute]