Skip to content

Commit 901c918

Browse files
committed
[stable/node-local-dns]: add configurable cache TTL
The cache TTL for DNS records was hardcoded to 30 seconds. This is too aggressive for external hostnames with longer TTLs (e.g. AWS ALBs return 60s TTLs), causing unnecessary cache misses and upstream lookups. Add config.cacheTTL (default 30) to make this configurable without needing to override the entire Corefile via customConfig.
1 parent 550fd61 commit 901c918

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

stable/node-local-dns/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: node-local-dns
3-
version: 2.8.0
3+
version: 2.9.0
44
appVersion: 1.26.7
55
maintainers:
66
- name: gabrieladt

stable/node-local-dns/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# node-local-dns
22

3-
![Version: 2.8.0](https://img.shields.io/badge/Version-2.8.0-informational?style=flat-square) ![AppVersion: 1.26.7](https://img.shields.io/badge/AppVersion-1.26.7-informational?style=flat-square)
3+
![Version: 2.9.0](https://img.shields.io/badge/Version-2.9.0-informational?style=flat-square) ![AppVersion: 1.26.7](https://img.shields.io/badge/AppVersion-1.26.7-informational?style=flat-square)
44

55
A chart to install node-local-dns.
66

@@ -50,6 +50,7 @@ helm install my-release oci://ghcr.io/deliveryhero/helm-charts/node-local-dns -f
5050
|-----|------|---------|-------------|
5151
| affinity | object | `{}` | |
5252
| config.bindIp | bool | `false` | If false, it will bind 0.0.0.0, otherwise dnsServer and localDns will be used. https://github.com/bottlerocket-os/bottlerocket/issues/3711#issuecomment-1907087528 |
53+
| config.cacheTTL | int | `30` | Cache TTL in seconds for DNS records. https://coredns.io/plugins/cache/ |
5354
| config.commProtocol | string | `"force_tcp"` | Set communication protocol. Options are `prefer_udp` or `force_tcp` |
5455
| config.customConfig | string | `""` | Overrides the generated configuration with specified one. |
5556
| config.customUpstreamsvc | string | `""` | Use a custom upstreamsvc for -upstreamsvc |

stable/node-local-dns/templates/configmap.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ data:
5050
in-addr.arpa:53 {
5151
errors
5252
{{- if .Values.config.prefetch.enabled}}
53-
cache 30 {
53+
cache {{ .Values.config.cacheTTL }} {
5454
prefetch {{ .Values.config.prefetch.amount }} {{ .Values.config.prefetch.duration }} {{ .Values.config.prefetch.percentage }}
5555
}
5656
{{- else }}
57-
cache 30
57+
cache {{ .Values.config.cacheTTL }}
5858
{{- end }}
5959
reload
6060
loop
@@ -76,11 +76,11 @@ data:
7676
ip6.arpa:53 {
7777
errors
7878
{{- if .Values.config.prefetch.enabled}}
79-
cache 30 {
79+
cache {{ .Values.config.cacheTTL }} {
8080
prefetch {{ .Values.config.prefetch.amount }} {{ .Values.config.prefetch.duration }} {{ .Values.config.prefetch.percentage }}
8181
}
8282
{{- else }}
83-
cache 30
83+
cache {{ .Values.config.cacheTTL }}
8484
{{- end }}
8585
reload
8686
loop
@@ -105,11 +105,11 @@ data:
105105
{{- end }}
106106
errors
107107
{{- if .Values.config.prefetch.enabled}}
108-
cache 30 {
108+
cache {{ .Values.config.cacheTTL }} {
109109
prefetch {{ .Values.config.prefetch.amount }} {{ .Values.config.prefetch.duration }} {{ .Values.config.prefetch.percentage }}
110110
}
111111
{{- else }}
112-
cache 30
112+
cache {{ .Values.config.cacheTTL }}
113113
{{- end }}
114114
reload
115115
loop

stable/node-local-dns/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ config:
3232
# -- If true, return NOERROR when attempting to resolve an IPv6 address
3333
noIPv6Lookups: false
3434

35+
# -- Cache TTL in seconds for DNS records. https://coredns.io/plugins/cache/
36+
cacheTTL: 30
37+
3538
# -- If enabled, coredns will prefetch popular items when they are about to be expunged from the cache. https://coredns.io/plugins/cache/
3639
prefetch:
3740
enabled: false

0 commit comments

Comments
 (0)