mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #54756 from andrewrynhard/fix-bind-addr
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: fix the DNS addon bind address **What this PR does / why we need it**: Fixes a small bug introduced in #54437 The net package's definition of `To16` is as follows: ``` // To16 converts the IP address ip to a 16-byte representation. // If ip is not an IP address (it is the wrong length), To16 returns nil. func (ip IP) To16() IP { if len(ip) == IPv4len { return IPv4(ip[0], ip[1], ip[2], ip[3]) } if len(ip) == IPv6len { return ip } return nil } ``` We can see that the `To16 ` function returns a non nil value when passed in an IPv4 address. This PR switches the check to use `To4()` instead, which will return `nil` when passed an IPv6 address.
This commit is contained in:
commit
c87d3d91db
@ -57,7 +57,7 @@ func EnsureDNSAddon(cfg *kubeadmapi.MasterConfiguration, client clientset.Interf
|
||||
}
|
||||
|
||||
var dnsBindAddr string
|
||||
if dnsip.To16() != nil {
|
||||
if dnsip.To4() == nil {
|
||||
dnsBindAddr = "::1"
|
||||
} else {
|
||||
dnsBindAddr = "127.0.0.1"
|
||||
|
Loading…
Reference in New Issue
Block a user