Skip to content

Commit

Permalink
external-dns update
Browse files Browse the repository at this point in the history
  • Loading branch information
kuritka committed Feb 28, 2025
1 parent b95e4a3 commit 8ba8e21
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
36 changes: 16 additions & 20 deletions chart/k8gb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Create the name of the service account to use
{{- if .Values.route53.enabled -}}
k8gb-{{ .Values.route53.hostedZoneID }}-{{ .Values.k8gb.clusterGeoTag }}
{{- else -}}
k8gb-{{ .Values.k8gb.dnsZone }}-{{ .Values.k8gb.clusterGeoTag }}
k8gb-{{ index (split ":" (index (split ";" (include "k8gb.dnsZonesString" .)) "_0")) "_1" }}-{{ .Values.k8gb.clusterGeoTag }}
{{- end -}}
{{- end -}}

Expand All @@ -96,24 +96,6 @@ k8gb-{{ .Values.k8gb.dnsZone }}-{{ .Values.k8gb.clusterGeoTag }}
{{- end -}}
{{- end -}}


{{- define "k8gb.dnsZonesList" -}}
{{- $entries := list -}}

{{- range .Values.k8gb.dnsZones }}
{{- $dnsZoneNegTTL := .dnsZoneNegTTL | default 300 }}
{{- $entries = append $entries (dict "zone" .zone "domain" .domain "dnsZoneNegTTL" $dnsZoneNegTTL) }}
{{- end }}

{{- if and (or (not .Values.k8gb.dnsZones) (eq (len .Values.k8gb.dnsZones) 0)) .Values.k8gb.dnsZone .Values.k8gb.edgeDNSZone }}
{{- $dnsZoneNegTTL := 300 }} # Default value
{{- $entries = append $entries (dict "zone" .Values.k8gb.edgeDNSZone "domain" .Values.k8gb.dnsZone "dnsZoneNegTTL" $dnsZoneNegTTL) }}
{{- end }}

{{- toYaml $entries | list }}
{{- end }}


{{- define "k8gb.dnsZonesString" -}}
{{- $entries := list -}}
{{- range .Values.k8gb.dnsZones }}
Expand All @@ -129,6 +111,14 @@ k8gb-{{ .Values.k8gb.dnsZone }}-{{ .Values.k8gb.clusterGeoTag }}
{{- end }}


{{- define "k8gb.coredns.extraPlugins" -}}
{{- if .Values.k8gb.coredns.extra_plugins }}
{{- range .Values.k8gb.coredns.extra_plugins }}
{{ . }}
{{- end }}
{{- end }}
{{- end }}

{{- define "k8gb.extdnsProviderOpts" -}}
{{- if .Values.ns1.enabled -}}
{{- if .Values.ns1.endpoint -}}
Expand Down Expand Up @@ -172,7 +162,13 @@ k8gb-{{ .Values.k8gb.dnsZone }}-{{ .Values.k8gb.clusterGeoTag }}
- --rfc2136-{{ $kk }}={{ $vv }}
{{- end }}
{{- end }}
- --rfc2136-zone={{ .Values.k8gb.edgeDNSZone }}
{{- $dnsZonesRaw := include "k8gb.dnsZonesString" . }}
{{- $dnsZones := split ";" $dnsZonesRaw }}
{{- range $dnsZones }}
{{- $parts := split ":" . }}
{{- $zone := index $parts "_0" }}
- --rfc2136-zone={{ $zone }}
{{- end }}
env:
- name: EXTERNAL_DNS_RFC2136_TSIG_SECRET
valueFrom:
Expand Down
8 changes: 7 additions & 1 deletion chart/k8gb/templates/external-dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ spec:
image: {{ .Values.externaldns.image }}
args:
- --source=crd
- --domain-filter={{ .Values.k8gb.edgeDNSZone }} # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
{{- $dnsZonesRaw := include "k8gb.dnsZonesString" . }}
{{- $dnsZones := split ";" $dnsZonesRaw }}
{{- range $dnsZones }}
{{- $parts := split ":" . }}
{{- $zone := index $parts "_0" }}
- --domain-filter={{ $zone }} # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
{{- end }}
- --policy=sync # enable full synchronization including record removal
- --log-level=debug # debug only
- --managed-record-types=A
Expand Down
9 changes: 5 additions & 4 deletions chart/k8gb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ k8gb:
deployRbac: true
# DNSZones - For backward compatibility, the dnsZone and edgeDNSZone fields are allowed; otherwise,
# the dnsZones array is used. For valid values, use either dnsZone and edgeDNSZone or dnsZones.
#
# -- dnsZone: deprecated
# dnsZone: "cloud.example.com"
# -- edgeDNSZone: deprecated
# edgeDNSZone: "example.com"
# -- array of dns zones controlled by gslb
# -- array of dns zones controlled by gslb§
dnsZones:
- zone: "example.com" # -- main zone which would contain gslb zone to delegate (same meaning as to edgeDNSZone)
domain: "cloud.example.com" # -- domain controlled by gslb (same meaning as to dnsZone)
dnsZoneNegTTL: 30 # -- Negative TTL for SOA record# -- host/ip[:port] format is supported here where port defaults to 53
- zone: "example.org" # -- main zone which would contain gslb zone to delegate (same meaning as to edgeDNSZone)
domain: "cloud.example.org" # -- domain controlled by gslb (same meaning as to dnsZone)
dnsZoneNegTTL: 50 # -- Negative TTL for SOA record# -- host/ip[:port] format is supported here where port defaults to 53
# - zone: "example.org" # -- main zone which would contain gslb zone to delegate (same meaning as to edgeDNSZone)
# domain: "cloud.example.org" # -- domain controlled by gslb (same meaning as to dnsZone)
# dnsZoneNegTTL: 50 # -- Negative TTL for SOA record# -- host/ip[:port] format is supported here where port defaults to 53
edgeDNSServers:
# -- use this DNS server as a main resolver to enable cross k8gb DNS based communication
- "1.1.1.1"
Expand Down

0 comments on commit 8ba8e21

Please sign in to comment.