kubeadm: Warn on API server bind address override

ChooseAPIServerBindAddress is silently overriding the requested bind IP
address for the API server if that address is deemed unsuitable. This is
currently done only if the IP is a loopback one (127.0.0.0/8; ::1/128).
It's best to at least issue a warning if such override occurs, so that there
are no surprised users by this.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
This commit is contained in:
Rostislav M. Georgiev 2018-11-16 12:38:16 +02:00
parent 973b5d291d
commit b46fbbc4e6

View File

@ -19,6 +19,7 @@ package config
import (
"io/ioutil"
"net"
"reflect"
"strings"
"github.com/pkg/errors"
@ -175,5 +176,8 @@ func ChooseAPIServerBindAddress(bindAddress net.IP) (net.IP, error) {
}
return nil, err
}
if bindAddress != nil && !bindAddress.IsUnspecified() && !reflect.DeepEqual(ip, bindAddress) {
klog.Warningf("WARNING: overriding requested API server bind address: requested %q, actual %q", bindAddress, ip)
}
return ip, nil
}