Support NodeLocalDNS on IPv6 clusters

This commit is contained in:
John Gardiner Myers 2021-11-27 19:19:29 -08:00
parent 56577a910e
commit a502a37990
3 changed files with 8 additions and 5 deletions

View File

@ -91,7 +91,11 @@ func (b *KubeDnsOptionsBuilder) BuildOptions(o interface{}) error {
nodeLocalDNS.Enabled = fi.Bool(false)
}
if fi.BoolValue(nodeLocalDNS.Enabled) && nodeLocalDNS.LocalIP == "" {
nodeLocalDNS.LocalIP = "169.254.20.10"
if clusterSpec.IsIPv6Only() {
nodeLocalDNS.LocalIP = "fd00:90de:d95::1"
} else {
nodeLocalDNS.LocalIP = "169.254.20.10"
}
}
if fi.BoolValue(nodeLocalDNS.Enabled) && nodeLocalDNS.ForwardToKubeDNS == nil {
nodeLocalDNS.ForwardToKubeDNS = fi.Bool(false)

View File

@ -54,7 +54,7 @@ data:
force_tcp
}
prometheus :9253
health {{ KubeDNS.NodeLocalDNS.LocalIP }}:{{ NodeLocalDNSHealthCheck }}
health {{ joinHostPort KubeDNS.NodeLocalDNS.LocalIP NodeLocalDNSHealthCheck }}
}
{{- if WithDefaultBool KubeDNS.NodeLocalDNS.ForwardToKubeDNS false }}
.:53 {
@ -99,9 +99,6 @@ data:
bind {{ KubeDNS.NodeLocalDNS.LocalIP }}
forward . __PILLAR__UPSTREAM__SERVERS__
prometheus :9253
{{- if IsIPv6Only }}
dns64
{{- end }}
}
{{- end }}
---

View File

@ -31,6 +31,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"net"
"os"
"path"
"sort"
@ -87,6 +88,7 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap, secretStore fi.SecretS
dest["join"] = func(a []string, sep string) string {
return strings.Join(a, sep)
}
dest["joinHostPort"] = net.JoinHostPort
sprigTxtFuncMap := sprig.TxtFuncMap()
dest["nindent"] = sprigTxtFuncMap["nindent"]